alibaba/open-code-review · error

review failed ( )

Error message

review failed (%s)

What it means

Terminal failure branch that interpolates the manifest's terminal state name (e.g. failed with a specific state label) — the run reached the failed terminal state and nothing usable was covered. The state string in the message identifies which failure mode the session recorded.

Solutions

  1. The run manifest reached terminal state 'failed' — every selected review item failed or the run aborted before producing usable coverage
  2. Inspect the manifest's run_failure details and per-item errors (output via --output JSON)
  3. Fix the underlying cause (credentials, network, repository state) and retry, optionally with --resume <session-id>
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/opencodereview/review_cmd.go:331 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/f7810b5a0a4fc1f9. Report an issue: GitHub.

Appendix: source

Thrown at cmd/opencodereview/review_cmd.go:331

		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,
	}
	if current.ReviewMode == session.ReviewModeWorkspace {

View on GitHub (pinned to 5cf97d0d15)