{"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":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":9197,"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, &view)?;\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":9179,"sourceCodeEnd":9215,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L9179-L9215","documentation":"`codewhale pr <N>` shells out to the GitHub CLI (`gh`) to fetch PR metadata and the diff. Before doing so it checks is_command_available(\"gh\"); if `gh` is not on PATH it bails with install/auth instructions, because the whole command depends on it.","triggerScenarios":"Running any `codewhale pr <N>` command on a machine where the `gh` binary is not installed or is not on the current PATH.","commonSituations":"Fresh CI container or devcontainer without GitHub CLI; `gh` installed via a version manager whose PATH is not active in the script environment; running inside Docker or systemd where PATH is minimal.","solutions":["Install the GitHub CLI (https://cli.github.com) and ensure it is on PATH (`gh --version`)","Authenticate with `gh auth login`","In CI/scripts, install gh in the setup step and/or extend PATH (e.g. `export PATH=\"$HOME/.local/bin:$PATH\"`)"],"exampleFix":"// before (CI step)\n- run: codewhale pr 123\n// after\n- run: |\n    type -p gh || (sudo apt-get install -y gh)\n    gh auth login --with-token < token.txt\n    codewhale pr 123","handlingStrategy":"validation","validationCode":"command -v gh >/dev/null 2>&1 || { echo 'gh CLI missing'; exit 1; }\ngh auth status >/dev/null 2>&1 || { echo 'gh not authenticated'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install gh in CI images / devcontainers used for codewhale","Verify with `gh --version` and `gh auth status` in setup steps","Watch for PATH differences between interactive shells and scripts/services"],"tags":["cli","gh","missing-binary","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"}