denisidoro/navi · error · anyhow

navi was unable to call wget. Make sure wget is correctly in

Error message

navi was unable to call wget.
Make sure wget is correctly installed.

What it means

`clients::cheatsh::call` spawns `wget` to fetch a cheatsheet from the cheat.sh service. If the process cannot be spawned at all (IO error from Command::spawn), navi returns `anyhow!("navi was unable to call wget. Make sure wget is correctly installed.")`. It signals a missing/unusable wget binary on the host.

Source

Thrown at src/clients/cheatsh.rs:32

    .map(map_line)
    .collect()
}

pub fn call(query: &str) -> Result<Vec<String>> {
    let args = ["-qO-", &format!("cheat.sh/{query}")];

    let child = Command::new("wget")
        .args(args)
        .stdin(Stdio::piped())
        .stdout(Stdio::piped())
        .spawn();

    let child = match child {
        Ok(x) => x,
        Err(_) => {
            let msg = "navi was unable to call wget.
Make sure wget is correctly installed.";
            return Err(anyhow!(msg));
        }
    };

    let out = child.wait_with_output().context("Failed to wait for wget")?;

    if let Some(0) = out.status.code() {
        let stdout = out.stdout;
        let plain_bytes = strip_ansi_escapes::strip(stdout);

        let markdown = String::from_utf8(plain_bytes).context("Output is invalid utf8")?;
        if markdown.starts_with("Unknown topic.") {
            let msg = format!(
                "`{}` not found in cheatsh.
Output:
{}
",
                &query, markdown,
            );

View on GitHub (pinned to f7330b9ad5)

Solutions

  1. Install wget (apt install wget / brew install wget / apk add wget)
  2. Verify with `which wget && wget --version` that it's on PATH
  3. Switch navi's cheatsheet source to a local directory or another client that doesn't need wget
  4. If wget exists but is unreachable, fix your PATH environment

Example fix

// before
$ navi cheatsheet some-query
Error: navi was unable to call wget.
// after
$ sudo apt-get install -y wget
$ which wget
/usr/bin/wget
$ navi cheatsheet some-query
Defensive patterns

Strategy: validation

Validate before calling

use std::process::Command;
fn wget_available() -> bool {
    Command::new("wget").arg("--version").output()
        .map(|o| o.status.success()).unwrap_or(false)
}
if !wget_available() {
    eprintln!("install wget before using the cheat.sh client");
    std::process::exit(1);
}

Try / catch

match navi::clients::cheatsh::call(query, opts) {
    Ok(lines) => render(lines),
    Err(e) if e.to_string().contains("unable to call wget") => {
        eprintln!("wget missing: install it with your package manager");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Using `navi` with the cheat.sh client when `Command::new("wget")...spawn()` returns Err: wget is not installed, not on PATH, or lacks execute permission.

Common situations: Fresh containers/minimal distros without wget, PATH missing /usr/bin in cron or GUI-launched contexts, corrupted wget install, or users who only have curl installed.

Related errors


AI-assisted analysis of denisidoro/navi@f7330b9ad5 (2026-09-03). Data as JSON: /api/errors/0423b8d2ed4fe0e2. Report an issue: GitHub.