{"record":{"id":"97da069cef80fc8e","repo":"nikivdev/code","slug":"claude-review-failed","errorCode":null,"errorMessage":"Claude review failed","messagePattern":"Claude review failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/commit.rs","lineNumber":5734,"sourceCode":"            return Ok(ReviewResult {\n                issues_found: false,\n                issues: Vec::new(),\n                summary: Some(format!(\n                    \"Claude review timed out after {}s\",\n                    timeout.as_secs()\n                )),\n                future_tasks: Vec::new(),\n                timed_out: true,\n                quality: None,\n            });\n        }\n\n        if !status.success() {\n            if !stderr_output.trim().is_empty() {\n                println!(\"{}\", stderr_output.trim_end());\n            }\n            println!(\"\\nnotify: Claude review failed\");\n            bail!(\"Claude review failed\");\n        }\n\n        let result = output_lines.join(\"\\n\");\n\n        let mut review_json = parse_review_json(&result);\n        let future_tasks = review_json\n            .as_ref()\n            .map(|parsed| normalize_future_tasks(&parsed.future_tasks))\n            .unwrap_or_default();\n        let summary = review_json.as_ref().and_then(|r| r.summary.clone());\n        let quality = review_json.as_mut().and_then(|r| r.quality.take());\n        let (issues_found, issues) = if let Some(ref parsed) = review_json {\n            if let Some(summary) = parsed.summary.as_ref() {\n                debug!(summary = summary.as_str(), \"claude review summary\");\n            }\n            (parsed.issues_found, parsed.issues.clone())\n        } else if result.trim().is_empty() {\n            (false, Vec::new())","sourceCodeStart":5716,"sourceCodeEnd":5752,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/commit.rs#L5716-L5752","documentation":"Thrown when the Claude CLI subprocess used for review exits with a non-success status. Any captured stderr is printed to the user first, then the library bails with this generic message; Claude's own diagnostics appear just above it in output.","triggerScenarios":"Invoking the claude binary for a review where the process returns a non-zero exit code — auth failure, CLI error, invalid arguments, model/API outage.","commonSituations":"Claude CLI not logged in or API key expired; claude binary missing/outdated; invalid model name (ClaudeModel); network outage to Anthropic API; prompt too long.","solutions":["Read the stderr lines printed immediately before this error for Claude's actual reason.","Re-authenticate Claude CLI (`claude` / `claude login`).","Update the Claude CLI binary and verify the configured model name is valid.","Test `claude` manually with a trivial prompt to isolate CLI vs. integration issues.","Retry; transient Anthropic API errors often clear."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// preflight: claude CLI present and authenticated\nlet probe = Command::new(\"claude\").arg(\"--version\").output()?;\nif !probe.status.success() {\n    anyhow::bail!(\"claude CLI missing or not authenticated\");\n}","typeGuard":null,"tryCatchPattern":"match run_claude_review(&diff).await {\n    Ok(r) => r,\n    Err(e) if e.to_string() == \"Claude review failed\" => {\n        // stderr was already printed; offer fallback\n        eprintln!(\"Claude failed; falling back to local heuristics\");\n        fallback_review()\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep the Claude CLI installed, updated, and logged in; smoke-test before commit flows","Pin/validate the configured ClaudeModel name against CLI-supported models","Capture and surface stderr — the real cause is printed above this error","Add timeouts and retry for transient Anthropic API failures"],"tags":["claude","subprocess","ai-review","exit-code"],"backgroundTag":"ai-cli-nonzero-exit","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}