{"record":{"id":"3cf79acd46a4c195","repo":"LGUG2Z/komorebi","slug":"unable-to-get-exec-path","errorCode":null,"errorMessage":"unable to get exec path","messagePattern":"unable to get exec path","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"komorebic-no-console/src/main.rs","lineNumber":10,"sourceCode":"#![windows_subsystem = \"windows\"]\n\nuse std::io;\nuse std::os::windows::process::CommandExt;\nuse std::process::Command;\n\nconst CREATE_NO_WINDOW: u32 = 0x08000000;\n\nfn main() -> io::Result<()> {\n    let mut current_exe = std::env::current_exe().expect(\"unable to get exec path\");\n    current_exe.pop();\n    let komorebic_exe = current_exe.join(\"komorebic.exe\");\n\n    Command::new(komorebic_exe)\n        .args(std::env::args_os().skip(1))\n        .creation_flags(CREATE_NO_WINDOW)\n        .status()\n        .map(|_| ())\n}\n","sourceCodeStart":1,"sourceCodeEnd":20,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebic-no-console/src/main.rs#L1-L20","documentation":"komorebic-no-console is a thin wrapper binary that shells out to komorebic.exe located next to itself, hiding the console window. At startup it resolves its own executable path via std::env::current_exe() and panics with 'unable to get exec path' if the OS cannot provide it. This is an OS-level failure to locate the running binary, not a komorebi logic error.","triggerScenarios":"std::env::current_exe() returns Err when the executable path cannot be determined: the binary was deleted or replaced while running, it was launched from a context with no resolvable path (e.g. some service hosts, tmp-cleaned environments), or the process image was unlinked.","commonSituations":"Running komorebic-no-console.exe from a temp directory that antivirus or cleanup tools have wiped; launching the binary through a symlink/foucher whose target was removed; exotic process-launch environments on Windows where the image path is unavailable.","solutions":["Ensure the komorebic-no-console.exe binary exists on disk at a stable location and was not deleted/quarantined while running","Reinstall or update komorebi so the binary and its sibling komorebic.exe are intact in the same directory","Exclude the komorebi install directory from antivirus quarantine/cleanup","If current_exe() keeps failing in your launch context, invoke komorebic.exe directly instead of the no-console wrapper"],"exampleFix":"// before (fragile path resolution in a cleaned tmp dir)\nlet mut current_exe = std::env::current_exe().expect(\"unable to get exec path\");\n// after\nlet current_exe = std::env::current_exe().unwrap_or_else(|e| {\n    eprintln!(\"failed to resolve executable path: {e}\");\n    std::process::exit(1);\n});","handlingStrategy":"try-catch","validationCode":"// Rust: check the binary path before relying on the wrapper\nfn exe_ok() -> bool {\n    std::env::current_exe().map(|p| p.is_file()).unwrap_or(false)\n      && std::env::current_exe().ok()\n           .and_then(|mut p| { p.pop(); Some(p.join(\"komorebic.exe\").is_file()) })\n           .unwrap_or(false)\n}","typeGuard":"fn resolvable_exe() -> Option<std::path::PathBuf> {\n    std::env::current_exe().ok().filter(|p| p.is_file())\n}","tryCatchPattern":"match std::env::current_exe() {\n    Ok(exe) => run_with(exe),\n    Err(e) => { eprintln!(\"cannot resolve exec path: {e}\"); std::process::exit(1); }\n}","preventionTips":["Keep komorebi binaries in a stable install dir (scoop/cargo) not temp folders","Exclude the install directory from antivirus/cleanup tools","Verify komorebic.exe and komorebic-no-console.exe are co-located after updates","Prefer invoking komorebic.exe directly if your launch context hides the image path"],"tags":["rust","windows","filesystem","panic"],"backgroundTag":"file-not-found","analyzedSha":"e0709f02bfae4e503bf4640f58ee75ecbbfdbb97","analyzedAt":"2026-09-06T07:08:05.107Z","contentChangedAt":"2026-09-06T07:08:05.107Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}