Hmbown/CodeWhale · error

gh not found on PATH

Error message

gh not found on PATH

What it means

Dependency guard on the GitHub CLI path: crate::dependencies::Gh::command() returned None, meaning the `gh` executable was not found on PATH. It fires before any `gh pr` subprocess is spawned, so no network or repository access happened.

Solutions

  1. Install the GitHub CLI (https://cli.github.com/) and ensure `gh` is on PATH.
  2. Point PATH at the directory containing gh and re-run the command.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/tui/src/lib.rs:9281 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/5a2d2c4968547cc7. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/lib.rs:9281

            }
        }
    }
    false
}

use crate::tools::review_pr::GhPullRequest;

fn run_gh_pr_view(number: u32, repo: Option<&str>) -> Result<GhPullRequest> {
    crate::tools::review_pr::fetch_view(number, repo, &std::env::current_dir()?)
}

fn run_gh_pr_diff(number: u32, repo: Option<&str>, view: &GhPullRequest) -> Result<String> {
    crate::tools::review_pr::fetch_diff(number, repo, &std::env::current_dir()?, view)
}

fn run_gh_pr_checkout(number: u32, repo: Option<&str>) -> Result<()> {
    let mut cmd = crate::dependencies::Gh::command()
        .ok_or_else(|| anyhow::anyhow!("gh not found on PATH"))?;
    cmd.arg("pr").arg("checkout").arg(number.to_string());
    if let Some(r) = repo {
        cmd.arg("--repo").arg(r);
    }
    let output = cmd
        .output()
        .map_err(|e| anyhow::anyhow!("Failed to run `gh pr checkout`: {e}"))?;
    if !output.status.success() {
        let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string();
        bail!("gh pr checkout #{number} failed: {stderr}");
    }
    Ok(())
}

/// Resolve the `owner/name` repository `gh` believes the current workspace
/// belongs to. `gh api` needs an explicit repository path, unlike `gh pr`
/// which infers it from the working directory.
fn run_gh_repo_name() -> Result<String> {

View on GitHub (pinned to 73e0f67d83)