{"record":{"id":"93cdfcaca5b965fc","repo":"alibaba/open-code-review","slug":"resume-mode-q-is-not-supported","errorCode":null,"errorMessage":"resume mode %q is not supported","messagePattern":"resume mode %q is not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/session/resume.go","lineNumber":288,"sourceCode":"// 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}\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 != ReviewModeFullScan {\n\t\treturn fmt.Errorf(\"resume session review mode %q does not match current mode %q\", s.ReviewMode, ReviewModeFullScan)\n\t}\n\tcurrent := normalizeScanPaths(scanPaths)\n\tif s.HasScanPathScope && !equalStringSlices(s.ScanPaths, current) {\n\t\treturn fmt.Errorf(\"resume session scan path scope %q does not match current scope %q\", formatScanScope(s.ScanPaths), formatScanScope(current))","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/internal/session/resume.go#L270-L306","documentation":"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.","triggerScenarios":"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).","commonSituations":"Typo in a script constructing SessionOptions; version skew where a new mode exists upstream but this build only knows range and commit.","solutions":["Set ReviewMode to one of the supported constants (ReviewModeRange or ReviewModeCommit)","Fix the typo in the mode string in your script/wrapper","Upgrade open-code-review if a newer mode is required"],"exampleFix":"// before\nopts.ReviewMode = \"commmit\"\n// after\nopts.ReviewMode = session.ReviewModeCommit","handlingStrategy":"validation","validationCode":"if opts.ReviewMode != session.ReviewModeRange && opts.ReviewMode != session.ReviewModeCommit {\n\treturn fmt.Errorf(\"unsupported mode %q\", opts.ReviewMode)\n}","typeGuard":null,"tryCatchPattern":"if err := state.ValidateOptions(opts); err != nil {\n\tif strings.Contains(err.Error(), \"is not supported\") {\n\t\treturn fmt.Errorf(\"%w; use range or commit\", err)\n\t}\n\treturn err\n}","preventionTips":["Only assign ReviewMode from the library's exported constants","Gate new review-mode values behind a version check of the library"],"tags":["go","resume","validation","unsupported-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}