{"record":{"id":"58f6f3ffae8112e1","repo":"alibaba/open-code-review","slug":"resume-requires-from-to-or-commit-workspace-58f6f3","errorCode":null,"errorMessage":"resume requires --from/--to or --commit; workspace resume is not supported","messagePattern":"resume requires --from/--to or --commit; workspace resume is not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/session/resume.go","lineNumber":279,"sourceCode":"\t\t\t\tout[item.Fingerprint] = true\n\t\t\t}\n\t\t}\n\t}\n\treturn out\n}\n\n// ValidateOptions verifies that this session can be resumed in the requested\n// review mode at all. It deliberately does not compare the ref text the user\n// typed: `abc1234` and `abc1234def` can name the same commit while a ref whose\n// name did not change can name a new one, so ref spellings are neither\n// sufficient nor necessary evidence about the input. ValidateResume compares the\n// resolved input identity instead.\nfunc (s *ResumeState) ValidateOptions(opts SessionOptions) error {\n\tif s == nil {\n\t\treturn nil\n\t}\n\tif opts.ReviewMode == \"\" || opts.ReviewMode == ReviewModeWorkspace {\n\t\treturn fmt.Errorf(\"resume requires --from/--to or --commit; workspace resume is not supported\")\n\t}\n\tif s.ReviewMode == \"\" {\n\t\treturn fmt.Errorf(\"resume session %q is missing review mode metadata\", s.SessionID)\n\t}\n\tif s.ReviewMode != opts.ReviewMode {\n\t\treturn fmt.Errorf(\"resume session review mode %q does not match current mode %q\", s.ReviewMode, opts.ReviewMode)\n\t}\n\tif opts.ReviewMode != ReviewModeRange && opts.ReviewMode != ReviewModeCommit {\n\t\treturn fmt.Errorf(\"resume mode %q is not supported\", opts.ReviewMode)\n\t}\n\treturn nil\n}\n\n// ValidateScanOptions verifies that the previous session was a full-file scan.\nfunc (s *ResumeState) ValidateScanOptions(scanPaths []string) error {\n\tif s == nil {\n\t\treturn nil\n\t}","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/internal/session/resume.go#L261-L297","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nocr review --resume <id>            # workspace mode\n// after\nocr review --resume <id> --from main --to HEAD","handlingStrategy":"validation","validationCode":"if opts.ReviewMode == \"\" || opts.ReviewMode == session.ReviewModeWorkspace {\n\treturn errors.New(\"resume needs --from/--to or --commit\")\n}\nerr := state.ValidateOptions(opts) // only after mode check","typeGuard":null,"tryCatchPattern":"if err := state.ValidateOptions(opts); err != nil {\n\tif strings.Contains(err.Error(), \"workspace resume is not supported\") {\n\t\treturn fmt.Errorf(\"%w; add --from/--to or --commit\", err)\n\t}\n\treturn err\n}","preventionTips":["Always pass --from/--to or --commit when resuming","Never build resume flows on top of workspace-mode runs","Validate CLI flags before constructing SessionOptions"],"tags":["go","cli","resume","validation"],"backgroundTag":"resume-mode-unsupported","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}