/* Copyright 2026 Marimo. All rights reserved. */ import { useAtom } from "jotai"; import { CopyIcon, HomeIcon, XCircleIcon } from "lucide-react"; import { kernelStartupErrorAtom } from "@/core/errors/state"; import { AlertDialog, AlertDialogAction, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "../ui/alert-dialog"; import { Button } from "../ui/button"; import { toast } from "../ui/use-toast"; /** * Modal that displays kernel startup errors. * Shows when the kernel fails to start in sandbox mode, * displaying the stderr output so users can diagnose the issue. */ export const KernelStartupErrorModal: React.FC = () => { const [error, setError] = useAtom(kernelStartupErrorAtom); if (error === null) { return null; } const handleCopy = async () => { try { await navigator.clipboard.writeText(error); toast({ title: "Copied to clipboard", description: "Error details have been copied to your clipboard.", }); } catch { toast({ title: "Failed to copy", description: "Could not copy to clipboard.", variant: "danger", }); } }; const handleClose = () => { setError(null); }; const handleReturnHome = () => { const withoutSearch = document.baseURI.split("?")[0]; window.open(withoutSearch, "_self"); }; return ( !open && handleClose()}> Kernel Startup Failed The kernel failed to start. This usually happens when the package manager can't install your notebook's dependencies.
Error Details
            {error}
          
Dismiss
); };