{"record":{"id":"1b07a3d9f4460c8f","repo":"slint-ui/slint","slug":"could-not-find-executable-name-of-the-slint-lsp","errorCode":null,"errorMessage":"Could not find executable name of the slint-lsp","messagePattern":"Could not find executable name of the slint-lsp","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"tools/lsp/main.rs","lineNumber":312,"sourceCode":") -> Result<()> {\n    let request_queue = OutgoingRequestQueue::default();\n    #[cfg_attr(not(feature = \"preview-engine\"), allow(unused))]\n    let (preview_to_lsp_sender, preview_to_lsp_receiver) =\n        mpsc::unbounded_channel::<PreviewToLspMessage>();\n\n    let server_notifier = ServerNotifier::new(connection.sender.clone(), request_queue.clone());\n\n    #[cfg(not(feature = \"preview-engine\"))]\n    let to_preview = LspToPreviews::with_one(editor_preview::DummyLspToPreview::default());\n    #[cfg(feature = \"preview-engine\")]\n    let to_preview = {\n        use i_slint_live_preview::protocol::PreviewTarget;\n\n        let sn = server_notifier.clone();\n\n        let child_preview: Box<dyn editor_preview::LspToPreview> =\n            Box::new(connector::ChildProcessLspToPreview::new(\n                std::env::current_exe().expect(\"Could not find executable name of the slint-lsp\"),\n                vec![\"live-preview\".into(), \"--remote-controlled\".into()],\n                preview_to_lsp_sender.clone(),\n            ));\n        let embedded_preview: Box<dyn editor_preview::LspToPreview> =\n            Box::new(connector::EmbeddedLspToPreview::new(sn.clone()));\n        LspToPreviews::new(\n            std::collections::HashMap::from([\n                (PreviewTarget::ChildProcess, child_preview),\n                (PreviewTarget::EmbeddedWasm, embedded_preview),\n            ]),\n            PreviewTarget::ChildProcess,\n            #[cfg(feature = \"preview-remote\")]\n            |to_previews| {\n                Rc::new(connector::remote::RemoteLspToPreview::new(\n                    preview_to_lsp_sender.clone(),\n                    to_previews,\n                ))\n            },","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/tools/lsp/main.rs#L294-L330","documentation":"When the preview-engine feature spawns an embedded live preview as a child process, slint-lsp resolves its own binary path with `std::env::current_exe().expect(...)` to re-invoke itself as `slint-lsp live-preview --remote-controlled`. `current_exe` fails when the OS cannot determine the path of the running executable, and the expect then panics, aborting `main_loop` startup.","triggerScenarios":"Running slint-lsp in an environment where /proc is unavailable or the binary path is unreadable: deleted binary after exec (Linux), containers/chroots without /proc mounted, some FreeBSD/NetBSD configurations, binaries run from memfd or via unusual exec mechanisms, or restricted permission setups.","commonSituations":"Docker images that unmount /proc or run with restricted procfs; security sandboxes hiding /proc/self/exe; running the LSP binary from a tmpfs that was cleaned while running; embedding slint-lsp inside a single-binary packer that execs from memory.","solutions":["Ensure /proc is mounted in the container (e.g. mount -t proc proc /proc) so /proc/self/exe is resolvable.","Verify the slint-lsp binary on disk has not been deleted or replaced (deleted-file inode) while the LSP is running; restart from a valid path.","Build/run slint-lsp with the preview-engine child-process requirement avoided: use the embedded preview path or a slint-lsp build/feature configuration that does not spawn `live-preview`.","As a code-level fix, replace the expect with a graceful fallback (e.g. locate the binary via PATH or skip the child-process preview) and log an error instead of panicking."],"exampleFix":"// before\nlet exe = std::env::current_exe().expect(\"Could not find executable name of the slint-lsp\");\n\n// after\nlet exe = std::env::current_exe().unwrap_or_else(|e| {\n    tracing::error!(\"cannot resolve own executable ({e}); disabling child preview\");\n    std::process::exit(1);\n});","handlingStrategy":"validation","validationCode":"// deployment check before enabling the child-process preview\nif !std::path::Path::new(\"/proc/self/exe\").exists() {\n    eprintln(\"/proc unavailable: embedded child preview will fail to spawn\");\n}","typeGuard":"fn current_exe_ok() -> bool { std::env::current_exe().is_ok() }","tryCatchPattern":"// at startup, resolve once and fail fast with a clear message\nlet exe = std::env::current_exe()\n    .map_err(|e| format!(\"cannot locate slint-lsp binary for child preview: {e}\"))?;","preventionTips":["Mount /proc in containers that run slint-lsp with the preview engine.","Do not delete or atomically replace the LSP binary while it is running.","Avoid exec'ing slint-lsp from memory-only mechanisms (memfd) in preview mode.","Prefer the embedded (non-child-process) preview when running in restricted sandboxes."],"tags":["lsp","process","filesystem","panic","linux"],"backgroundTag":"file-not-found","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}