{"record":{"id":"42470db7e1c351ca","repo":"Hmbown/CodeWhale","slug":"failed-to-run-gh-pr-checkout-e","errorCode":null,"errorMessage":"Failed to run `gh pr checkout`: {e}","messagePattern":"Failed to run `gh pr checkout`: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":8193,"sourceCode":"        .output()\n        .map_err(|e| anyhow::anyhow!(\"Failed to run `gh pr diff`: {e}\"))?;\n    if !output.status.success() {\n        let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string();\n        bail!(\"gh pr diff #{number} failed: {stderr}\");\n    }\n    Ok(String::from_utf8_lossy(&output.stdout).to_string())\n}\n\nfn run_gh_pr_checkout(number: u32, repo: Option<&str>) -> Result<()> {\n    let mut cmd = crate::dependencies::Gh::command()\n        .ok_or_else(|| anyhow::anyhow!(\"gh not found on PATH\"))?;\n    cmd.arg(\"pr\").arg(\"checkout\").arg(number.to_string());\n    if let Some(r) = repo {\n        cmd.arg(\"--repo\").arg(r);\n    }\n    let output = cmd\n        .output()\n        .map_err(|e| anyhow::anyhow!(\"Failed to run `gh pr checkout`: {e}\"))?;\n    if !output.status.success() {\n        let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string();\n        bail!(\"gh pr checkout #{number} failed: {stderr}\");\n    }\n    Ok(())\n}\n\n/// Format the PR review prompt that lands in the composer. Caps the\n/// diff at 200 KiB so a massive PR doesn't blow the model's context\n/// window before the user even hits Enter — they can always ask the\n/// model to fetch more via `gh pr diff #N` from inside the session.\nfn format_pr_prompt(number: u32, view: &GhPullRequest, diff: &str) -> String {\n    const MAX_DIFF_BYTES: usize = 200 * 1024;\n    let diff_section = if diff.len() > MAX_DIFF_BYTES {\n        let cut = (0..=MAX_DIFF_BYTES)\n            .rev()\n            .find(|&i| diff.is_char_boundary(i))\n            .unwrap_or(0);","sourceCodeStart":8175,"sourceCodeEnd":8211,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/lib.rs#L8175-L8211","documentation":"Error \"Failed to run `gh pr checkout`: {e}\" thrown in Hmbown/CodeWhale.","triggerScenarios":"Thrown at crates/tui/src/lib.rs:8193 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}