zeroclaw-labs/zeroclaw · warning · DiagItem
{cmd} not found in PATH
Error message
{cmd} not found in PATH What it means
A `zeroclaw doctor` warning from `check_command_available`: spawning the probed command (`git` or `curl`) failed at the OS level — classically `ErrorKind::NotFound`, meaning the binary is not on PATH. Doctor probes these because several features (workspace tooling, HTTP fallbacks) depend on them being usable.
Source
Thrown at crates/zeroclaw-runtime/src/doctor/mod.rs:1821
.args(args)
.stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::piped())
.output()
{
Ok(output) if output.status.success() => {
let ver = String::from_utf8_lossy(&output.stdout);
let first_line = ver.lines().next().unwrap_or("").trim();
let display = truncate_for_display(first_line, COMMAND_VERSION_PREVIEW_CHARS);
items.push(DiagItem::ok(cat, format!("{cmd}: {display}")));
}
Ok(_) => {
items.push(DiagItem::warn(
cat,
format!("{cmd} found but returned non-zero"),
));
}
Err(_) => {
items.push(DiagItem::warn(cat, format!("{cmd} not found in PATH")));
}
}
}
fn format_error_chain(error: &anyhow::Error) -> String {
let mut parts = Vec::new();
for cause in error.chain() {
let message = cause.to_string();
if !message.is_empty() {
parts.push(message);
}
}
if parts.is_empty() {
return String::new();
}
parts.join(": ")View on GitHub (pinned to 88bb9c8533)
Solutions
- Install the missing tool: `apt-get install -y git curl` (or the platform equivalent).
- If it is installed, extend PATH for the context doctor runs in (unit `Environment=PATH=...`, container ENV, shell profile).
- Re-run `zeroclaw doctor` and confirm the `<cmd>: <version>` ok line.
Example fix
# before: doctor -> "git not found in PATH" # after (Debian/Ubuntu) apt-get update && apt-get install -y git curl
Defensive patterns
Strategy: validation
Validate before calling
fn on_path(cmd: &str) -> bool {
std::process::Command::new(cmd).arg("--version")
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.output()
.is_ok()
}
for cmd in ["git", "curl"] {
assert!(on_path(cmd), "{cmd} not found in PATH");
} Type guard
fn command_on_path(cmd: &str) -> bool {
std::process::Command::new(cmd).arg("--version").output().is_ok()
} Prevention
- Install git and curl in base images rather than assuming they exist.
- Pin an explicit PATH in service units and containers so spawn-not-found cannot happen at runtime.
When it happens
Trigger: Running `zeroclaw doctor` when `git` or `curl` is not installed, or is installed outside the PATH visible to doctor — common in minimal containers, clean-room servers, and systemd units with a restricted PATH.
Common situations: Slim Docker images (no build tools); hardened VMs; macOS/Linux servers where Xcode CLT or curl is missing; service units whose PATH lacks `/usr/bin`.
Related errors
- {cmd} found but returned non-zero
- neither $SHELL nor %ComSpec% is set
- systemd user lingering disabled; user service may stop after
- systemd user lingering could not be checked with loginctl
- No CLI tools found in PATH
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/78a721a0b42a0735.
Report an issue: GitHub.