{"record":{"id":"94c16daf4f75a0e9","repo":"Hmbown/CodeWhale","slug":"pr-input-command-failed","errorCode":null,"errorMessage":"PR input command failed: {}","messagePattern":"PR input command failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/review_pr.rs","lineNumber":509,"sourceCode":"        None => {\n            let _ = child.kill();\n            let _ = child.wait();\n            bail!(\"PR input command timed out; no partial output was accepted\");\n        }\n    };\n    let stdout = stdout\n        .join()\n        .map_err(|_| anyhow::anyhow!(\"PR stdout reader failed\"))??;\n    let stderr = stderr\n        .join()\n        .map_err(|_| anyhow::anyhow!(\"PR stderr reader failed\"))??;\n    if stdout.len() > MAX_OUTPUT_BYTES || stderr.len() > 64 * 1024 {\n        bail!(\n            \"PR input exceeds the bounded capture limit (8 MiB diff); no partial output was accepted\"\n        );\n    }\n    if !status.success() {\n        bail!(\n            \"PR input command failed: {}\",\n            String::from_utf8_lossy(&stderr).trim()\n        );\n    }\n    String::from_utf8(stdout).context(\"PR diff is not valid UTF-8; no lossy review is accepted\")\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    fn view(files: usize) -> GhPullRequest {\n        GhPullRequest {\n            title: \"Fixture\".into(),\n            body: String::new(),\n            base: \"main\".into(),\n            head: \"feature\".into(),\n            url: \"https://github.com/example/repo/pull/6002\".into(),","sourceCodeStart":491,"sourceCodeEnd":527,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/review_pr.rs#L491-L527","documentation":"After the size checks pass, run_command verifies the child process exit status. Any non-zero exit makes it bail with 'PR input command failed: {stderr}', embedding the trimmed stderr text so the caller can see why git/gh failed.","triggerScenarios":"Any git/gh invocation run through run_command (fetch_diff, fetch_view, context_blob, git()) exits non-zero — e.g. bad ref, missing remote, authentication failure, nonexistent PR branch.","commonSituations":"Reviewing a PR whose branch was deleted or not fetched locally; gh/git not authenticated; wrong repository remote; typo'd ref or revision passed to fetch_diff/fetch_view.","solutions":["Read the embedded stderr in the error message to identify the underlying git/gh failure","Run the same command manually to reproduce: confirm refs exist with `git rev-parse <ref>` / `gh pr view <id>`","Authenticate: run `gh auth login` or configure git credentials for the remote","Ensure the PR ref is fetched locally (`git fetch origin pull/<id>/head`) before reviewing"],"exampleFix":"// before\nreview_pr(\"origin/pr-9999\") // ref never fetched\n// after\ngit([\"fetch\", \"origin\", \"pull/9999/head\"])?;\nreview_pr(\"FETCH_HEAD\")","handlingStrategy":"try-catch","validationCode":"let ok = std::process::Command::new(\"git\").args([&\"rev-parse\", ref]).output().map(|o| o.status.success()).unwrap_or(false);","typeGuard":null,"tryCatchPattern":"match result { Err(e) if e.to_string().contains(\"PR input command failed\") => { log stderr embedded in e; check refs/auth } , Ok(v) => v }","preventionTips":["Verify refs exist (`git rev-parse`) before reviewing","Authenticate gh/git beforehand (`gh auth status`)","Fetch the PR ref locally before running the review"],"tags":["git","subprocess","command-failed","pr-review"],"backgroundTag":"git-command-failed","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"}