{"record":{"id":"c5692b2b72251eb7","repo":"alibaba/open-code-review","slug":"review-failed-s-s","errorCode":null,"errorMessage":"review failed (%s): %s","messagePattern":"review failed \\((.+?)\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/opencodereview/review_cmd.go","lineNumber":329,"sourceCode":"func 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)\n\t\t}\n\t\treturn fmt.Errorf(\"review failed: %d of %d selected item(s) failed\",\n\t\t\tlen(manifest.Coverage.Failed), len(manifest.Coverage.Selected))\n\t}\n\treturn nil\n}\n\nfunc loadReviewResumeState(repoDir string, opts reviewOptions) (*session.ResumeState, error) {\n\tif opts.resume == \"\" {\n\t\treturn nil, nil\n\t}\n\tcurrent := session.SessionOptions{\n\t\tReviewMode: reviewModeFromOptions(opts),\n\t\tDiffFrom:   opts.from,\n\t\tDiffTo:     opts.to,\n\t\tDiffCommit: opts.commit,","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/review_cmd.go#L311-L347","documentation":"The run executed but the manifest's TerminalState is StateFailed — no usable coverage was produced (as opposed to a run-level exception, which yields the 'review failed: %w' branch). The state name and diagnostic are interpolated into the message. Per the exit contract, this is the non-zero exit path for a run that finished but failed outright.","triggerScenarios":"Thrown at cmd/opencodereview/review_cmd.go:329 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the run error and per-item failures in the emitted manifest","Re-run the review for the failed items; use the session ID on stderr to resume with --resume","Check the exit contract: only a run-level failure or all-items-failed produces this error; partial coverage exits 0"],"exampleFix":null,"handlingStrategy":"validation","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"}