Hmbown/CodeWhale · error · anyhow::Error
`gh` CLI not found on PATH. Install GitHub CLI…
Error message
`gh` CLI not found on PATH. Install GitHub CLI (https://cli.github.com) and authenticate (`gh auth login`) so `codewhale review --pr` can fetch the pull request.
What it means
`codewhale review --pr` fetches the pull request via the GitHub CLI; before doing so it probes PATH for `gh`. If the binary is absent, it bails with install/auth guidance since the review cannot fetch the PR any other way.
Solutions
- Install the GitHub CLI (https://cli.github.com)
- Run `gh auth login` to authenticate after installing
- Ensure the gh binary is on PATH (`which gh`)
- Alternatively review a local diff without --pr
Example fix
// before codewhale review --pr 123 // after brew install gh && gh auth login codewhale review --pr 123
Defensive patterns
Strategy: validation
Validate before calling
if !which("gh").is_ok() { eprintln!("install gh: https://cli.github.com"); return 1; } Prevention
- Install gh in CI images that run `review --pr`
- Check `which gh` during environment setup
- Authenticate with `gh auth login` after install
When it happens
Trigger: Running review --pr N when `gh` is not installed or not on PATH (is_command_available("gh") returns false).
Common situations: Fresh machines without GitHub CLI; CI containers missing gh; gh installed via snap/nvm-style location not on PATH; typo'd PATH in the environment.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- A positive pull request number is required
- AT-SPI walk failed — is python3-pyatspi installed and the…
- gh api POST repos/ /pulls/ /reviews failed
- `gh` CLI not found on PATH. Install GitHub CLI…
- gh did not report a pull request URL; refusing to invent…
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/bb0a3067ded91414.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/lib.rs:8594
.map_err(|_| anyhow::anyhow!("Invalid input"))?;
let session = sessions
.get(idx.saturating_sub(1))
.ok_or_else(|| anyhow::anyhow!("Selection out of range"))?;
Ok(session.id.clone())
}
async fn run_review(config: &Config, args: ReviewArgs) -> Result<()> {
initialize_cloud_facts(config);
use crate::client::CodewhaleClient;
// Resolved before anything is fetched or billed so an unknown
// `--provider` fails fast with the provider vocabulary hint.
let (config, force_configured_route) = review_execution_route(config, &args)?;
let config = &config;
validate_review_receipt_args(&args)?;
if args.pr.is_some() && !is_command_available("gh") {
bail!(
"`gh` CLI not found on PATH. Install GitHub CLI \
(https://cli.github.com) and authenticate (`gh auth login`) \
so `codewhale review --pr` can fetch the pull request."
);
}
// Fetched before the diff so a missing/hidden PR fails before any model
// route is resolved or billed.
let pr_view = match args.pr {
Some(number) => Some((number, run_gh_pr_view(number, args.repo.as_deref())?)),
None => None,
};
let diff = collect_diff(
&args,
pr_view.as_ref().map(|(_, view)| view),
&std::env::current_dir()?,
)?;
if diff.trim().is_empty() {
bail!("No diff to review.");View on GitHub (pinned to 73e0f67d83)