alibaba/open-code-review · error

resume mode %q is not supported

Error message

resume mode %q is not supported

What it means

ResumeState.ValidateOptions rejects when opts.ReviewMode is a value other than ReviewModeRange or ReviewModeCommit. This is a final safety net for unrecognized/unsupported review mode strings passed after the earlier workspace/empty checks.

Source

Thrown at internal/session/resume.go:288

// typed: `abc1234` and `abc1234def` can name the same commit while a ref whose
// name did not change can name a new one, so ref spellings are neither
// sufficient nor necessary evidence about the input. ValidateResume compares the
// resolved input identity instead.
func (s *ResumeState) ValidateOptions(opts SessionOptions) error {
	if s == nil {
		return nil
	}
	if opts.ReviewMode == "" || opts.ReviewMode == ReviewModeWorkspace {
		return fmt.Errorf("resume requires --from/--to or --commit; workspace resume is not supported")
	}
	if s.ReviewMode == "" {
		return fmt.Errorf("resume session %q is missing review mode metadata", s.SessionID)
	}
	if s.ReviewMode != opts.ReviewMode {
		return fmt.Errorf("resume session review mode %q does not match current mode %q", s.ReviewMode, opts.ReviewMode)
	}
	if opts.ReviewMode != ReviewModeRange && opts.ReviewMode != ReviewModeCommit {
		return fmt.Errorf("resume mode %q is not supported", opts.ReviewMode)
	}
	return nil
}

// ValidateScanOptions verifies that the previous session was a full-file scan.
func (s *ResumeState) ValidateScanOptions(scanPaths []string) error {
	if s == nil {
		return nil
	}
	if s.ReviewMode == "" {
		return fmt.Errorf("resume session %q is missing review mode metadata", s.SessionID)
	}
	if s.ReviewMode != ReviewModeFullScan {
		return fmt.Errorf("resume session review mode %q does not match current mode %q", s.ReviewMode, ReviewModeFullScan)
	}
	current := normalizeScanPaths(scanPaths)
	if s.HasScanPathScope && !equalStringSlices(s.ScanPaths, current) {
		return fmt.Errorf("resume session scan path scope %q does not match current scope %q", formatScanScope(s.ScanPaths), formatScanScope(current))

View on GitHub (pinned to 5cf97d0d15)

Solutions

  1. Set ReviewMode to one of the supported constants (ReviewModeRange or ReviewModeCommit)
  2. Fix the typo in the mode string in your script/wrapper
  3. Upgrade open-code-review if a newer mode is required

Example fix

// before
opts.ReviewMode = "commmit"
// after
opts.ReviewMode = session.ReviewModeCommit
Defensive patterns

Strategy: validation

Validate before calling

if opts.ReviewMode != session.ReviewModeRange && opts.ReviewMode != session.ReviewModeCommit {
	return fmt.Errorf("unsupported mode %q", opts.ReviewMode)
}

Try / catch

if err := state.ValidateOptions(opts); err != nil {
	if strings.Contains(err.Error(), "is not supported") {
		return fmt.Errorf("%w; use range or commit", err)
	}
	return err
}

Prevention

When it happens

Trigger: Passing an arbitrary or newly invented mode string in SessionOptions.ReviewMode that is not "range" or "commit" (e.g. a typo like "commmit", or a mode added by a newer tool version being read by an older one).

Common situations: Typo in a script constructing SessionOptions; version skew where a new mode exists upstream but this build only knows range and commit.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02). Data as JSON: /api/errors/93cdfcaca5b965fc. Report an issue: GitHub.