{"record":{"id":"326db7ec2e65ffa4","repo":"denisidoro/navi","slug":"unable-to-acquire-stdin-of-finder","errorCode":null,"errorMessage":"Unable to acquire stdin of finder","messagePattern":"Unable to acquire stdin of finder","errorType":"exception","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"src/finder/mod.rs","lineNumber":222,"sourceCode":"                let repo = match self {\n                    Self::Fzf => \"https://github.com/junegunn/fzf\",\n                    Self::Skim => \"https://github.com/lotabout/skim\",\n                };\n                eprintln!(\n                    \"navi was unable to call {cmd}.\n                Please make sure it's correctly installed.\n                Refer to {repo} for more info.\",\n                    cmd = &finder_str,\n                    repo = repo\n                );\n                process::exit(33)\n            }\n        };\n\n        let stdin = child\n            .stdin\n            .as_mut()\n            .ok_or_else(|| anyhow!(\"Unable to acquire stdin of finder\"))?;\n\n        let mut writer: Box<&mut dyn Write> = Box::new(stdin);\n\n        let return_value = stdin_fn(&mut writer).context(\"Failed to pass data to finder\")?;\n\n        let out = child.wait_with_output().context(\"Failed to wait for finder\")?;\n\n        let output = parse(out, finder_opts).context(\"Unable to get output\")?;\n        Ok((output, return_value))\n    }\n}\n","sourceCodeStart":204,"sourceCodeEnd":234,"githubUrl":"https://github.com/denisidoro/navi/blob/f7330b9ad5bd95b7d1a3c96d00e0a77deb589147/src/finder/mod.rs#L204-L234","documentation":"Thrown by `call` in src/finder/mod.rs (via `ask_if_should_import_all`) when spawning the external finder process (e.g. fzf) succeeded, but the child's stdin handle is absent (`child.stdin` is None). Without stdin the library cannot stream data to the finder, so it aborts.","triggerScenarios":"Calling a finder-backed operation that needs to pipe input to the spawned finder process when `Command::spawn()` produced a child with `stdin: None` — e.g. the child was spawned with stdin not piped, or stdin was already taken/consumed elsewhere.","commonSituations":"Running in an environment with no TTY/standard input available (CI, non-interactive shells, detached processes); the finder binary configured in settings cannot accept piped stdin; a prior call already drained the child's stdin.","solutions":["Ensure the finder subprocess is configured with `Stdio::piped()` for stdin before spawning","Run the command in an interactive terminal where the finder can attach to stdin/stdout","Verify the configured finder binary (fzf/skim) is correctly installed and is the real interactive finder, not a wrapper that closes stdin","Check that no other code path calls `.stdin.take()` on the child before this point"],"exampleFix":"// before\nlet child = Command::new(finder).stdout(Stdio::piped()).spawn()?;\n// after\nlet child = Command::new(finder)\n    .stdin(Stdio::piped())\n    .stdout(Stdio::piped())\n    .spawn()?;","handlingStrategy":"try-catch","validationCode":"// before invoking the finder, ensure an interactive stdin is plausible\nif !atty::is(atty::Stream::Stdin) {\n    eprintln!(\"finder requires an interactive stdin (TTY)\");\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"Unable to acquire stdin of finder\") => {\n        eprintln!(\"Run inside an interactive terminal with a TTY attached.\");\n    }\n    other => other?,\n}","preventionTips":["Only use finder-backed features in interactive terminals, not CI or detached scripts","Verify the configured finder binary (fzf/skim) is installed and is the real interactive finder","Don't wrap the finder in scripts that close or redirect stdin"],"tags":["process","stdin","external-finder"],"backgroundTag":"missing-stdin-pipe","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"}