{"record":{"id":"db50f8623478c375","repo":"denisidoro/navi","slug":"external-command-failed-err","errorCode":null,"errorMessage":"External command failed:\n {err}","messagePattern":"External command failed:\n (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/finder/mod.rs","lineNumber":45,"sourceCode":"    fn from_str(s: &str) -> Result<Self, Self::Err> {\n        match s {\n            \"fzf\" => Ok(FinderChoice::Fzf),\n            \"skim\" => Ok(FinderChoice::Skim),\n            _ => Err(\"no match\"),\n        }\n    }\n}\n\nfn parse(out: Output, opts: Opts) -> Result<String> {\n    let text = match out.status.code() {\n        Some(0) | Some(1) | Some(2) => {\n            String::from_utf8(out.stdout).context(\"Invalid utf8 received from finder\")?\n        }\n        Some(130) => process::exit(130),\n        _ => {\n            let err = String::from_utf8(out.stderr)\n                .unwrap_or_else(|_| \"<stderr contains invalid UTF-8>\".to_owned());\n            panic!(\"External command failed:\\n {err}\")\n        }\n    };\n\n    let output = post::parse_output_single(text, opts.suggestion_type)?;\n    post::process(output, opts.column, opts.delimiter.as_deref(), opts.map)\n}\n\nimpl FinderChoice {\n    fn check_fzf_version() -> Option<(u32, u32, u32)> {\n        let output = Command::new(\"fzf\").arg(\"--version\").output().ok()?.stdout;\n        let version_string = String::from_utf8(output).ok()?;\n        let version_parts: Vec<_> = version_string.split('.').collect();\n        if version_parts.len() == 3 {\n            let major = version_parts[0].parse().ok()?;\n            let minor = version_parts[1].parse().ok()?;\n            let patch = version_parts[2].split_whitespace().next()?.parse().ok()?;\n            Some((major, minor, patch))\n        } else {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/denisidoro/navi/blob/f7330b9ad5bd95b7d1a3c96d00e0a77deb589147/src/finder/mod.rs#L27-L63","documentation":"In `finder::parse`, after navi spawns an external fuzzy-finder process (fzf, sk, etc.) and reads its output, any exit code other than the handled ones (e.g. 0 for selection, 130 for user abort) triggers a panic including the child's stderr. This means the finder itself failed rather than the user simply canceling.","triggerScenarios":"`call` -> `parse` when the spawned finder exits with an unexpected status: fzf not actually installed (shell falls back or errors), fzf crashing, invalid finder options/flags passed via finder configuration, or stderr produced by an incompatible finder version.","commonSituations":"fzf version too old for the flags navi passes, a custom `NAVI_FZF_OVERRIDES`/finder config with broken options, an aliased or wrapper 'fzf' that fails, or terminal issues (no TTY) causing the finder to abort.","solutions":["Run the finder command manually (`fzf --version`, then the exact invocation) to see the underlying stderr in the panic message","Update fzf to a recent version (navi relies on modern fzf features)","Fix or remove broken options in navi's finder override settings","Verify the configured finder binary is the real one (`which fzf`) and not a failing wrapper"],"exampleFix":"// before: navi panics with the finder's stderr\n$ navi\nExternal command failed:\n unknown option: --height40\n// after\n$ fzf --version && fzf --height 40%   # reproduce manually\n$ brew upgrade fzf   # or apt install newer fzf\n$ navi","handlingStrategy":"try-catch","validationCode":"use std::process::Command;\nfn finder_available() -> bool {\n    Command::new(\"fzf\").arg(\"--version\").output()\n        .map(|o| o.status.success()).unwrap_or(false)\n}\nif !finder_available() {\n    eprintln!(\"fzf is missing or broken; install/upgrade it\");\n    std::process::exit(1);\n}","typeGuard":"fn finder_output_ok(out: &std::process::Output) -> bool {\n    matches!(out.status.code(), Some(0) | Some(130))\n}","tryCatchPattern":"match navi::finder::call(opts) {\n    Ok(selection) => use_selection(selection),\n    Err(e) if e.to_string().contains(\"External command failed\") => {\n        eprintln!(\"finder failed: {}\", e);\n        eprintln!(\"check NAVI_FZF_OVERRIDES and your fzf version\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep fzf up to date (navi uses modern flags)","Review overrides/options passed to the finder for typos","Verify `which fzf` points at a real binary, not a failing alias","Run navi in a proper TTY environment"],"tags":["external-process","fzf","finder","exit-code"],"backgroundTag":"external-command-failed","analyzedSha":"f7330b9ad5bd95b7d1a3c96d00e0a77deb589147","analyzedAt":"2026-09-03T13:58:22.429Z","contentChangedAt":"2026-09-03T13:58:22.429Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}