alibaba/open-code-review · error
resume session review mode %q does not match current mode %q
Error message
resume session review mode %q does not match current mode %q
What it means
ResumeState.ValidateOptions rejects when the previous session's review mode differs from the currently requested one. Checkpoints (fingerprints, diff identity) are only meaningful within the same review mode, so cross-mode resume is refused.
Source
Thrown at internal/session/resume.go:285
// ValidateOptions verifies that this session can be resumed in the requested
// review mode at all. It deliberately does not compare the ref text the user
// 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)
}View on GitHub (pinned to 5cf97d0d15)
Solutions
- Invoke resume with the same mode the original session used (check the session JSONL's reviewMode field)
- Run a fresh review in the new mode instead of resuming
- Start a new session to keep both modes' results separate
Example fix
// before: session ran with --commit abc123 ocr review --resume <id> --from main --to HEAD // mismatch // after ocr review --resume <id> --commit abc123
Defensive patterns
Strategy: validation
Validate before calling
// read reviewMode from the session JSONL and require it to match before resuming
if storedMode != requestedMode { /* abort resume; start fresh in requested mode */ } Try / catch
if err := state.ValidateOptions(opts); err != nil {
if strings.Contains(err.Error(), "does not match current mode") {
return fmt.Errorf("%w; rerun with the original session's flags", err)
}
return err
} Prevention
- Record and reuse the exact CLI flags of the original run when resuming
- Keep one session id per review mode
- Don't switch between --commit and --from/--to under the same --resume id
When it happens
Trigger: Prior session was --commit but the resume request is --from/--to (range), or vice versa; prior was full-scan and the user now asks for range resume (or any other mode combination mismatch).
Common situations: User switches review workflow between commits and PR ranges but reuses an old --resume id; CI passes a different mode flag than the original run; muscle-memory flag reuse from a previous invocation.
Related errors
- %w (run 'ocr session list' to see available sessions)
- resume requires --from/--to or --commit; workspace resume is
- resume mode %q is not supported
- background file %q is a directory, not a file
- background file %q is %d bytes, exceeding the maximum of %d
AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02).
Data as JSON: /api/errors/4cc10fd9337b302e.
Report an issue: GitHub.