alibaba/open-code-review · error
review failed (%s): %s
Error message
review failed (%s): %s
What it means
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.
Source
Thrown at cmd/opencodereview/review_cmd.go:329
func reviewResultError(runErr error, manifest *session.RunManifest) error {
if runErr != nil {
return fmt.Errorf("review failed: %w", runErr)
}
if manifest != nil && manifest.TerminalState == session.StateFailed {
// The exit contract is: non-zero only for a run-level failure, or when
// every selected item failed. Any usable coverage — even incomplete — exits
// 0, so complete/partial/skipped all succeed and only failed lands here.
// That makes a budget stop exit 0 whenever anything was covered (it is a
// controlled truncation recording no run_failure) and non-zero only when
// the cap left nothing covered at all. Partial results are published
// regardless: runReview emits the frozen manifest before this error decides
// the exit status.
//
// Reasons stored in the manifest already went through sanitizeReason, so
// they are safe to echo on stderr.
if rf := manifest.RunFailure; rf != nil {
if rf.Reason != "" {
return fmt.Errorf("review failed (%s): %s", rf.Classification, rf.Reason)
}
return fmt.Errorf("review failed (%s)", rf.Classification)
}
return fmt.Errorf("review failed: %d of %d selected item(s) failed",
len(manifest.Coverage.Failed), len(manifest.Coverage.Selected))
}
return nil
}
func loadReviewResumeState(repoDir string, opts reviewOptions) (*session.ResumeState, error) {
if opts.resume == "" {
return nil, nil
}
current := session.SessionOptions{
ReviewMode: reviewModeFromOptions(opts),
DiffFrom: opts.from,
DiffTo: opts.to,
DiffCommit: opts.commit,View on GitHub (pinned to 5cf97d0d15)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cmd/opencodereview/review_cmd.go:329 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02).
Data as JSON: /api/errors/c5692b2b72251eb7.
Report an issue: GitHub.