nikivdev/code · error
binary '{}' not found
Error message
binary '{}' not found What it means
find_binary in src/daemon.rs resolves the daemon executable by checking a list of candidate paths; if none of the candidates exists on disk it bails with `binary '<name>' not found`. It is raised while starting the daemon (start_daemon_inner), meaning the CLI cannot locate the daemon executable it needs to spawn.
Source
Thrown at src/daemon.rs:550
if expanded.exists() {
return Ok(expanded);
}
// Try to find on PATH using `which`
let output = Command::new("which")
.arg(name)
.output()
.with_context(|| format!("failed to find binary '{}'", name))?;
if output.status.success() {
let path_str = String::from_utf8_lossy(&output.stdout);
let path = PathBuf::from(path_str.trim());
if path.exists() {
return Ok(path);
}
}
bail!("binary '{}' not found", name)
}
/// Check if a health endpoint is responding.
fn check_health(url: &str) -> bool {
let client = Client::builder()
.timeout(Duration::from_millis(750))
.build();
let Ok(client) = client else {
return false;
};
client
.get(url)
.send()
.and_then(|resp| resp.error_for_status())
.map(|_| true)
.unwrap_or(false)View on GitHub (pinned to a747e741ae)
Solutions
- Locate/install the missing binary (e.g. reinstall the CLI or build the daemon component) and ensure it is on PATH.
- Run `which <name>` in the same shell/environment to confirm it resolves; fix PATH if not.
- Check the install prefix (e.g. ~/.local/bin, ~/.cargo/bin) is in PATH for the process starting the daemon.
- Reinstall after a failed/partial upgrade so the binary exists again.
Example fix
// before: binary not on PATH
$ f daemon start // bail!("binary 'myapp-daemon' not found")
// after: ensure PATH includes install dir
export PATH="$HOME/.local/bin:$PATH" Defensive patterns
Strategy: validation
Validate before calling
// Rust: confirm the binary resolves before starting the daemon
fn ensure_binary_on_path(name: &str) -> anyhow::Result<()> {
let found = std::process::Command::new("which")
.arg(name)
.output()
.map(|o| o.status.success())
.unwrap_or(false);
anyhow::ensure!(found, "{} must be installed and on PATH before starting the daemon", name);
Ok(())
} Try / catch
match find_binary("myapp-daemon") {
Ok(path) => start_daemon(&path),
Err(e) if e.to_string().contains("not found") => {
eprintln!("Daemon binary missing — reinstall the CLI and ensure ~/.local/bin is on PATH.");
std::process::exit(1);
}
Err(e) => return Err(e),
} Prevention
- Add the install prefix (~/.local/bin, ~/.cargo/bin) to PATH in shell profiles.
- Reinstall the CLI after upgrades so helper binaries always exist.
- In CI, cache the installed daemon binary or install it as a setup step.
- Use absolute paths for daemon spawns where possible instead of PATH lookup.
When it happens
Trigger: Calling start_daemon_inner when the daemon binary was never installed, was installed outside the searched PATH/candidate locations, the candidate string contains extra whitespace handled by trim but a stale path, or the binary was deleted/upgraded between installs.
Common situations: Installing the CLI via cargo but the daemon helper went to a non-PATH directory; PATH differing between shell and daemon-spawned subprocess; partial upgrade that removed the old binary before installing the new one; running inside a container image that only shipped the CLI.
Related errors
- handled before project context load
- daemon is only supported for Codex sessions; use `f codex da
- codex doctor assertion failed: - {} next: run `f codex enabl
- ai not found in PATH
- failed to launch Cursor
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/2812d023be2a7831.
Report an issue: GitHub.