{"record":{"id":"616aef30875ac249","repo":"LGUG2Z/komorebi","slug":"unable-to-get-exec-path-616aef","errorCode":null,"errorMessage":"unable to get exec path","messagePattern":"unable to get exec path","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"komorebic/src/main.rs","lineNumber":1817,"sourceCode":"                );\n                println!(\n                    \"You are strongly encouraged to make your employer pay for your license, either directly or via reimbursement\"\n                );\n                println!(\n                    \"If you already have a license, you can run \\\"komorebic license <email>\\\" with the email address your license is associated with\"\n                );\n            }\n\n            println!(\"\\nYou can now run komorebic start --whkd --bar\");\n        }\n        SubCommand::EnableAutostart(args) => {\n            if args.ahk {\n                println!(\n                    \"EOL: The --ahk flag is now end-of-life and will not receive any further updates or bug fixes\"\n                );\n            }\n\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-no-console.exe\");\n            let komorebic_exe = dunce::simplified(&komorebic_exe);\n\n            let startup_dir = startup_dir()?;\n            let shortcut_file = startup_dir.join(\"komorebi.lnk\");\n            let shortcut_file = dunce::simplified(&shortcut_file);\n\n            let mut arguments = String::from(\"start\");\n\n            if let Some(config) = args.config {\n                arguments.push_str(\" --config \");\n                arguments.push_str(&config.to_string_lossy());\n            }\n\n            if args.ffm {\n                arguments.push_str(\" --ffm\");\n            }","sourceCodeStart":1799,"sourceCodeEnd":1835,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebic/src/main.rs#L1799-L1835","documentation":"When creating the startup shortcut, komorebic resolves its own executable directory via std::env::current_exe() to point the shortcut at komorebic-no-console.exe. It panics with 'unable to get exec path' if the OS cannot determine the running binary's path.","triggerScenarios":"Running 'komorebic startup install' (or equivalent) when std::env::current_exe() fails: the binary was deleted/replaced mid-run, launched via an unlinked path, or the launch environment cannot report the image path.","commonSituations":"Installing autostart from a wiped temp dir; antivirus quarantining komorebic.exe during the operation; exotic launchers (e.g. some package shims) that obscure the executable path.","solutions":["Run komorebic.exe from its stable install directory (e.g. scoop/cargo bin), not a temp path","Reinstall komorebi so the binaries are intact and co-located","Exclude the install directory from antivirus","Create the Startup shortcut manually pointing to komorebic-no-console.exe if current_exe keeps failing"],"exampleFix":"// before: run from a transient path\nC:\\Temp\\komorebic.exe startup install\n// after: run from the real install location\nC:\\Users\\me\\scoop\\apps\\komorebi\\current\\komorebic.exe startup install","handlingStrategy":"try-catch","validationCode":"// Verify the executable resolves and komorebic-no-console.exe is adjacent\nfn startup_ready() -> bool {\n    std::env::current_exe().ok()\n        .map(|mut p| { p.pop(); p.join(\"komorebic-no-console.exe\").is_file() })\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match std::env::current_exe() {\n    Ok(exe) => install_shortcut(exe),\n    Err(e) => eprintln!(\"shortcut install skipped: cannot resolve exec path: {e}\"),\n}","preventionTips":["Run the startup-install command from the real install directory","Avoid antivirus interference with the binaries during startup registration","Reinstall komorebi if binaries are missing or renamed after updates","Create the Startup .lnk manually as a fallback"],"tags":["rust","windows","filesystem","startup"],"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-14T00:17:10.932Z"}