{"record":{"id":"386d430cd0aaa52d","repo":"Hmbown/CodeWhale","slug":"gh-cli-not-found-on-path-install-github-cli-ht","errorCode":null,"errorMessage":"`gh` CLI not found on PATH. Install GitHub CLI (https://cli.github.com) and authenticate (`gh auth login`) so `codewhale pr <N>` can fetch PR metadata and the diff.","messagePattern":"`gh` CLI not found on PATH\\. Install GitHub CLI \\(https://cli\\.github\\.com\\) and authenticate \\(`gh auth login`\\) so `codewhale pr <N>` can fetch PR metadata and the diff\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":8155,"sourceCode":"    } else {\n        \"invalid\"\n    }\n}\n\n/// `codewhale pr <N>` (#451) — fetch a GitHub PR via `gh`, format\n/// title + body + diff as the composer's first message, and launch\n/// the interactive TUI. Falls back gracefully if `gh` is missing.\nasync fn run_pr(\n    cli: &Cli,\n    config: &Config,\n    number: u32,\n    repo: Option<&str>,\n    checkout: bool,\n    pending_telemetry_notice: Option<crate::telemetry_notice::PendingTelemetryNotice>,\n    plugin_registry: Arc<crate::plugins::PluginRegistry>,\n) -> Result<()> {\n    if !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 pr <N>` can fetch PR metadata and the diff.\"\n        );\n    }\n\n    let view = run_gh_pr_view(number, repo)?;\n    let diff = run_gh_pr_diff(number, repo)?;\n\n    if checkout {\n        match run_gh_pr_checkout(number, repo) {\n            Ok(()) => eprintln!(\"Checked out PR #{number} into the current workspace.\"),\n            Err(err) => eprintln!(\n                \"warning: gh pr checkout #{number} failed ({err}). Continuing without checkout.\"\n            ),\n        }\n    }\n","sourceCodeStart":8137,"sourceCodeEnd":8173,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/lib.rs#L8137-L8173","documentation":"run_pr() shells out to GitHub's `gh` for PR metadata and diff; its first act is an is_command_available(\"gh\") check that bails with install/auth instructions when gh is not on PATH. Note the doc comment above the function claims it \"falls back gracefully if gh is missing\", but the implementation hard-fails — the comment is stale.","triggerScenarios":"`codewhale pr <N>` on a machine where the gh binary is not installed or not on PATH (the check is name-based, so a shadowed or non-executable gh also fails).","commonSituations":"Fresh container or CI image without gh; gh installed for a different user or via a PATH not propagated into the session; minimal dev images.","solutions":["Install GitHub CLI (https://cli.github.com — e.g. `brew install gh` or your distro package)","Authenticate with `gh auth login`","Verify with `command -v gh` inside the same shell/environment codewhale runs in"],"exampleFix":"// before\n$ codewhale pr 42\nError: `gh` CLI not found on PATH. Install GitHub CLI ...\n\n// after\n$ brew install gh   # or: apt install gh / dnf install gh\n$ gh auth login\n$ codewhale pr 42","handlingStrategy":"validation","validationCode":"command -v gh >/dev/null 2>&1 || { echo 'gh missing: install from https://cli.github.com' >&2; exit 2; }\ngh auth status >/dev/null 2>&1 || { echo 'run: gh auth login' >&2; exit 2; }\ncodewhale pr \"$N\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bake gh into CI images and verify with `command -v gh` in preflight","Keep gh authenticated in automation via GH_TOKEN rather than interactive logins"],"tags":["github","pr","gh-cli","dependency-missing","path"],"backgroundTag":"command-not-found","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}