{"record":{"id":"f3738257a502f5c8","repo":"nikivdev/code","slug":"failed-to-exec-fish","errorCode":null,"errorMessage":"failed to exec fish: {}","messagePattern":"failed to exec fish: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/latest.rs","lineNumber":70,"sourceCode":"    let result = deploy::run(DeployCommand { action: None });\n    std::env::set_current_dir(prev).context(\"failed to restore previous directory\")?;\n    result\n}\n\nfn reload_fish_shell() -> Result<()> {\n    if std::env::var(\"FISH_VERSION\").is_err() {\n        return Ok(());\n    }\n    if !atty::is(atty::Stream::Stdout) {\n        return Ok(());\n    }\n\n    println!(\"Reloading fish shell...\");\n    #[cfg(unix)]\n    {\n        use std::os::unix::process::CommandExt;\n        let err = Command::new(\"fish\").arg(\"-l\").exec();\n        bail!(\"failed to exec fish: {}\", err);\n    }\n    #[cfg(not(unix))]\n    {\n        let _ = Command::new(\"fish\").arg(\"-l\").status();\n        Ok(())\n    }\n}\n","sourceCodeStart":52,"sourceCodeEnd":78,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/latest.rs#L52-L78","documentation":"reload_fish_shell replaces the current process with `fish -l` via Command::exec on Unix. exec only returns if it failed, so any value returned means fish could not be started, and the code bails with the OS error interpolated. On non-Unix it spawns fish instead and never errors.","triggerScenarios":"Calling run on a Unix system when the exec of `fish -l` fails: fish is not installed or not on PATH, the binary lacks execute permission, or the exec syscall fails for another OS-level reason.","commonSituations":"Machine uses bash/zsh and fish was never installed; fish installed outside PATH (e.g. /opt/homebrew/bin not in PATH in a non-interactive context); minimal container images without fish.","solutions":["Install fish (e.g. brew install fish or apt install fish) or add its directory to PATH","Verify fish is runnable: `which fish` / `fish -l` in the same environment","If you don't want a fish reload, run the command in an environment where the exec step is skipped (non-Unix path or alternate command)"],"exampleFix":"// before\nlet err = Command::new(\"fish\").arg(\"-l\").exec();\nbail!(\"failed to exec fish: {}\", err);\n// after (check availability first)\nif which::which(\"fish\").is_err() {\n    bail!(\"fish not found on PATH; install fish or skip reload\");\n}\nlet err = Command::new(\"fish\").arg(\"-l\").exec();\nbail!(\"failed to exec fish: {}\", err);","handlingStrategy":"validation","validationCode":"fn fish_available() -> bool {\n    std::process::Command::new(\"fish\")\n        .arg(\"-c\")\n        .arg(\"true\")\n        .output()\n        .map(|o| o.status.success())\n        .unwrap_or(false)\n}\nif !fish_available() { eprintln!(\"fish not installed/on PATH; reload skipped\"); }","typeGuard":"fn is_unix() -> bool { cfg!(unix) }","tryCatchPattern":"match reload_fish_shell() {\n    Err(e) if e.to_string().starts_with(\"failed to exec fish\") => {\n        eprintln!(\"fish exec failed — is fish installed and on PATH?\");\n    }\n    other => other?,\n}","preventionTips":["Install fish on all dev machines; keep it on PATH for non-interactive shells","Verify `command -v fish` in shell profiles/CI before relying on reload","Fall back to `exec $SHELL` if fish is unavailable"],"tags":["process-exec","unix","shell","path"],"backgroundTag":"command-not-found","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}