Hmbown/CodeWhale · error · anyhow::Error
Failed to run `gh pr view
Error message
Failed to run `gh pr view`: {e} What it means
Spawning the `gh pr view` subprocess itself failed (OS-level error such as permission denied or resource exhaustion) — the command never produced output. Distinct from gh exiting non-zero.
Solutions
- Confirm `gh` is installed and executable on PATH
- Check for OS-level issues (permissions, process/resource limits)
- Re-run the command after fixing the environment
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at crates/tui/src/lib.rs:8247 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/f3a1b89f8dfebfb4.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/lib.rs:8247
title: String,
body: String,
base: String,
head: String,
url: String,
}
fn run_gh_pr_view(number: u32, repo: Option<&str>) -> Result<GhPullRequest> {
let mut cmd = crate::dependencies::Gh::command()
.ok_or_else(|| anyhow::anyhow!("gh not found on PATH"))?;
cmd.arg("pr").arg("view").arg(number.to_string());
if let Some(r) = repo {
cmd.arg("--repo").arg(r);
}
cmd.arg("--json")
.arg("title,body,baseRefName,headRefName,url");
let output = cmd
.output()
.map_err(|e| anyhow::anyhow!("Failed to run `gh pr view`: {e}"))?;
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string();
bail!("gh pr view #{number} failed: {stderr}");
}
let raw = String::from_utf8_lossy(&output.stdout).to_string();
let value: serde_json::Value = serde_json::from_str(&raw)
.map_err(|e| anyhow::anyhow!("gh pr view returned non-JSON output: {e}"))?;
let pick = |key: &str| {
value
.get(key)
.and_then(serde_json::Value::as_str)
.unwrap_or_default()
.to_string()
};
Ok(GhPullRequest {
title: pick("title"),
body: pick("body"),
base: pick("baseRefName"),View on GitHub (pinned to 0c42157ee5)