alibaba/open-code-review · error
resume requires --from/--to or --commit; workspace resume is
Error message
resume requires --from/--to or --commit; workspace resume is not supported
What it means
ResumeState.ValidateOptions rejects resuming when the requested review mode is empty or workspace. Workspace reviews have no stable input identity (the diff changes under the working tree), so the library refuses to reuse checkpoints from them.
Source
Thrown at internal/session/resume.go:279
out[item.Fingerprint] = true
}
}
}
return out
}
// 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
}View on GitHub (pinned to 5cf97d0d15)
Solutions
- Re-run with --from <ref> --to <ref> or --commit <sha> to give resume a stable diff identity
- Do not attempt to resume a workspace-mode review; run it fresh instead
- Fix the wrapper/profile that omits the mode flags
Example fix
// before ocr review --resume <id> # workspace mode // after ocr review --resume <id> --from main --to HEAD
Defensive patterns
Strategy: validation
Validate before calling
if opts.ReviewMode == "" || opts.ReviewMode == session.ReviewModeWorkspace {
return errors.New("resume needs --from/--to or --commit")
}
err := state.ValidateOptions(opts) // only after mode check Try / catch
if err := state.ValidateOptions(opts); err != nil {
if strings.Contains(err.Error(), "workspace resume is not supported") {
return fmt.Errorf("%w; add --from/--to or --commit", err)
}
return err
} Prevention
- Always pass --from/--to or --commit when resuming
- Never build resume flows on top of workspace-mode runs
- Validate CLI flags before constructing SessionOptions
When it happens
Trigger: Calling ValidateOptions with opts.ReviewMode == "" or opts.ReviewMode == ReviewModeWorkspace — i.e. the CLI was invoked without --from/--to or --commit while trying to resume a session.
Common situations: User runs the resume flow against uncommitted working-tree changes; a wrapper script omitted the range/commit flags; a default profile silently picked workspace mode.
Related errors
- %w (run 'ocr session list' to see available sessions)
- background file %q is a directory, not a file
- background file %q is %d bytes, exceeding the maximum of %d
- invalid scan template: %w
- load resume session: %w (run 'ocr session list' to see avail
AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02).
Data as JSON: /api/errors/58f6f3ffae8112e1.
Report an issue: GitHub.