{"record":{"id":"261917881047f8f5","repo":"alibaba/open-code-review","slug":"review-failed-w","errorCode":null,"errorMessage":"review failed: %w","messagePattern":"review failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/opencodereview/review_cmd.go","lineNumber":313,"sourceCode":"\t\t// it whenever it ran (which it does even for a fully failed run, since a\n\t\t// failed manifest is still publishable), so the failure-usage path gets it\n\t\t// only when that call was skipped entirely.\n\t\tfailureReport := retryReport\n\t\tif emitted {\n\t\t\tfailureReport = nil\n\t\t}\n\t\temitFailureUsage(ag, time.Since(startTime), opts.outputFormat, llmIdentity, failureReport)\n\t\tif id := ag.SessionID(); id != \"\" {\n\t\t\tfmt.Fprintf(os.Stderr, \"[ocr] Session: %s (retry with: --resume %s)\\n\", id, id)\n\t\t}\n\t\treturn errors.Join(resultErr, emitErr)\n\t}\n\treturn emitErr\n}\n\nfunc reviewResultError(runErr error, manifest *session.RunManifest) error {\n\tif runErr != nil {\n\t\treturn fmt.Errorf(\"review failed: %w\", runErr)\n\t}\n\tif manifest != nil && manifest.TerminalState == session.StateFailed {\n\t\t// The exit contract is: non-zero only for a run-level failure, or when\n\t\t// every selected item failed. Any usable coverage — even incomplete — exits\n\t\t// 0, so complete/partial/skipped all succeed and only failed lands here.\n\t\t// That makes a budget stop exit 0 whenever anything was covered (it is a\n\t\t// controlled truncation recording no run_failure) and non-zero only when\n\t\t// the cap left nothing covered at all. Partial results are published\n\t\t// regardless: runReview emits the frozen manifest before this error decides\n\t\t// the exit status.\n\t\t//\n\t\t// Reasons stored in the manifest already went through sanitizeReason, so\n\t\t// they are safe to echo on stderr.\n\t\tif rf := manifest.RunFailure; rf != nil {\n\t\t\tif rf.Reason != \"\" {\n\t\t\t\treturn fmt.Errorf(\"review failed (%s): %s\", rf.Classification, rf.Reason)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"review failed (%s)\", rf.Classification)","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/review_cmd.go#L295-L331","documentation":"The review execution itself returned an error (runErr). executeReviewContext wraps it as 'review failed:' before joining it with any emit error; the manifest (if constructed) has still been emitted so partial results are available. Exit status will be non-zero.","triggerScenarios":"Thrown at cmd/opencodereview/review_cmd.go:313 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the wrapped runErr for the underlying failure (LLM errors, git errors, session delivery failures)","Check stderr for the retry report and session ID; retry with --resume <session-id> if a session was created","If only some items failed, the manifest is still published with partial coverage; inspect it to see which items failed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}