LGUG2Z/komorebi · error

unable to get exec path

Error message

unable to get exec path

What it means

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.

Source

Thrown at komorebic/src/main.rs:1817

                );
                println!(
                    "You are strongly encouraged to make your employer pay for your license, either directly or via reimbursement"
                );
                println!(
                    "If you already have a license, you can run \"komorebic license <email>\" with the email address your license is associated with"
                );
            }

            println!("\nYou can now run komorebic start --whkd --bar");
        }
        SubCommand::EnableAutostart(args) => {
            if args.ahk {
                println!(
                    "EOL: The --ahk flag is now end-of-life and will not receive any further updates or bug fixes"
                );
            }

            let mut current_exe = std::env::current_exe().expect("unable to get exec path");
            current_exe.pop();
            let komorebic_exe = current_exe.join("komorebic-no-console.exe");
            let komorebic_exe = dunce::simplified(&komorebic_exe);

            let startup_dir = startup_dir()?;
            let shortcut_file = startup_dir.join("komorebi.lnk");
            let shortcut_file = dunce::simplified(&shortcut_file);

            let mut arguments = String::from("start");

            if let Some(config) = args.config {
                arguments.push_str(" --config ");
                arguments.push_str(&config.to_string_lossy());
            }

            if args.ffm {
                arguments.push_str(" --ffm");
            }

View on GitHub (pinned to e0709f02bf)

Solutions

  1. Run komorebic.exe from its stable install directory (e.g. scoop/cargo bin), not a temp path
  2. Reinstall komorebi so the binaries are intact and co-located
  3. Exclude the install directory from antivirus
  4. Create the Startup shortcut manually pointing to komorebic-no-console.exe if current_exe keeps failing

Example fix

// before: run from a transient path
C:\Temp\komorebic.exe startup install
// after: run from the real install location
C:\Users\me\scoop\apps\komorebi\current\komorebic.exe startup install
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the executable resolves and komorebic-no-console.exe is adjacent
fn startup_ready() -> bool {
    std::env::current_exe().ok()
        .map(|mut p| { p.pop(); p.join("komorebic-no-console.exe").is_file() })
        .unwrap_or(false)
}

Try / catch

match std::env::current_exe() {
    Ok(exe) => install_shortcut(exe),
    Err(e) => eprintln!("shortcut install skipped: cannot resolve exec path: {e}"),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of LGUG2Z/komorebi@e0709f02bf (2026-09-06). Data as JSON: /api/errors/616aef30875ac249. Report an issue: GitHub.