{"record":{"id":"8d9f92303b1afe4e","repo":"Hmbown/CodeWhale","slug":"failed-to-run-gh-api-e","errorCode":null,"errorMessage":"Failed to run `gh api`: {e}","messagePattern":"Failed to run `gh api`: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":9728,"sourceCode":"        payload[\"commit_id\"] = serde_json::json!(commit_id);\n    }\n    if !comments.is_empty() {\n        payload[\"comments\"] = serde_json::json!(comments);\n    }\n    let mut cmd = crate::dependencies::Gh::command()\n        .ok_or_else(|| anyhow::anyhow!(\"gh not found on PATH\"))?;\n    cmd.arg(\"api\")\n        .arg(\"--method\")\n        .arg(\"POST\")\n        .arg(format!(\"repos/{repo}/pulls/{number}/reviews\"))\n        .arg(\"--input\")\n        .arg(\"-\")\n        .stdin(std::process::Stdio::piped())\n        .stdout(std::process::Stdio::piped())\n        .stderr(std::process::Stdio::piped());\n    let mut child = cmd\n        .spawn()\n        .map_err(|e| anyhow::anyhow!(\"Failed to run `gh api`: {e}\"))?;\n    *publication = ReviewPublication::Uncertain;\n    if let Some(stdin) = child.stdin.as_mut() {\n        use std::io::Write;\n        stdin\n            .write_all(serde_json::to_string(&payload)?.as_bytes())\n            .map_err(|e| anyhow::anyhow!(\"Failed to write review payload: {e}\"))?;\n    }\n    let output = child\n        .wait_with_output()\n        .map_err(|e| anyhow::anyhow!(\"Failed to wait for `gh api`: {e}\"))?;\n    if !output.status.success() {\n        let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string();\n        bail!(\"gh api POST repos/{repo}/pulls/{number}/reviews failed: {stderr}\");\n    }\n    *publication = ReviewPublication::Posted;\n    Ok(())\n}\n","sourceCodeStart":9710,"sourceCodeEnd":9746,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L9710-L9746","documentation":"The PR review submission's `gh api POST repos/{repo}/pulls/{number}/reviews` failed; the wrapped error carries gh's output so submission failures (permissions, closed PR, payload size) are diagnosable.","triggerScenarios":"Thrown at crates/tui/src/lib.rs:9728 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check gh authentication (`gh auth status`) and network, then retry.","Confirm the review payload is valid JSON and the repo/pr number are correct."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}