FuelLabs/fuels-rs · error

Program `find` not in PATH

Error message

Program `find` not in PATH

What it means

check-docs shells out to the find binary via std::process::Command to enumerate files and expects the spawn to succeed. The expect fires when the find executable is not on PATH or cannot be spawned; a find that runs but fails is reported separately by bail!.

Source

Thrown at scripts/check-docs/src/lib.rs:255

        .arg(pattern)
        .arg(location)
        .output()
        .expect("failed grep command");

    if !grep_project.status.success() {
        bail!("Failed running `grep` command for pattern '{}'", pattern);
    }

    Ok(String::from_utf8(grep_project.stdout)?)
}

pub fn find_files(pattern: &str, location: &str, exclude: &str) -> anyhow::Result<String> {
    let find = std::process::Command::new("find")
        .args([
            location, "-type", "f", "-name", pattern, "!", "-name", exclude,
        ])
        .output()
        .expect("Program `find` not in PATH");

    if !find.status.success() {
        bail!("Failed running `find` command for pattern {}", pattern);
    }

    Ok(String::from_utf8(find.stdout)?)
}

View on GitHub (pinned to d9a250a518)

Solutions

  1. Install findutils in the image (apt-get install -y findutils / apk add findutils)
  2. Run the script from an environment with standard core utilities on PATH
  3. Verify PATH includes /usr/bin (or wherever find lives)

Example fix

# before
RUN cargo run -p scripts/check-docs # panics: Program `find` not in PATH

# after
RUN apt-get update && apt-get install -y findutils
cargo run -p scripts/check-docs
Defensive patterns

Strategy: fallback

Validate before calling

# (shell) availability check before running check-docs
command -v find >/dev/null || { echo 'find (findutils) is required by check-docs'; exit 1; }

Prevention

When it happens

Trigger: Running check-docs in an environment where findutils is not installed (minimal containers, stripped-down CI images) or where PATH does not include the directory containing find.

Common situations: Distroless Docker images; Nix/scratch environments without findutils; CI PATH scrubbing.

Related errors


AI-assisted analysis of FuelLabs/fuels-rs@d9a250a518 (2026-08-16). Data as JSON: /api/errors/e685e8fe8d9ddedf. Report an issue: GitHub.