{"record":{"id":"bb0a3067ded91414","repo":"Hmbown/CodeWhale","slug":"gh-cli-not-found-on-path-install-github-cli-https-cli-github","errorCode":null,"errorMessage":"`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.","messagePattern":"`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\\.","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":8594,"sourceCode":"        .map_err(|_| anyhow::anyhow!(\"Invalid input\"))?;\n    let session = sessions\n        .get(idx.saturating_sub(1))\n        .ok_or_else(|| anyhow::anyhow!(\"Selection out of range\"))?;\n    Ok(session.id.clone())\n}\n\nasync fn run_review(config: &Config, args: ReviewArgs) -> Result<()> {\n    initialize_cloud_facts(config);\n    use crate::client::CodewhaleClient;\n\n    // Resolved before anything is fetched or billed so an unknown\n    // `--provider` fails fast with the provider vocabulary hint.\n    let (config, force_configured_route) = review_execution_route(config, &args)?;\n    let config = &config;\n    validate_review_receipt_args(&args)?;\n\n    if args.pr.is_some() && !is_command_available(\"gh\") {\n        bail!(\n            \"`gh` CLI not found on PATH. Install GitHub CLI \\\n             (https://cli.github.com) and authenticate (`gh auth login`) \\\n             so `codewhale review --pr` can fetch the pull request.\"\n        );\n    }\n    // Fetched before the diff so a missing/hidden PR fails before any model\n    // route is resolved or billed.\n    let pr_view = match args.pr {\n        Some(number) => Some((number, run_gh_pr_view(number, args.repo.as_deref())?)),\n        None => None,\n    };\n    let diff = collect_diff(\n        &args,\n        pr_view.as_ref().map(|(_, view)| view),\n        &std::env::current_dir()?,\n    )?;\n    if diff.trim().is_empty() {\n        bail!(\"No diff to review.\");","sourceCodeStart":8576,"sourceCodeEnd":8612,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L8576-L8612","documentation":"`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.","triggerScenarios":"Running review --pr N when `gh` is not installed or not on PATH (is_command_available(\"gh\") returns false).","commonSituations":"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.","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"],"exampleFix":"// before\ncodewhale review --pr 123\n// after\nbrew install gh && gh auth login\ncodewhale review --pr 123","handlingStrategy":"validation","validationCode":"if !which(\"gh\").is_ok() { eprintln!(\"install gh: https://cli.github.com\"); return 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install gh in CI images that run `review --pr`","Check `which gh` during environment setup","Authenticate with `gh auth login` after install"],"tags":["cli","github","missing-dependency","environment"],"backgroundTag":"command-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}