{"record":{"id":"31784db2edf2c783","repo":"alibaba/open-code-review","slug":"resume-requires-from-to-or-commit-workspace","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":"cmd/opencodereview/review_cmd.go","lineNumber":350,"sourceCode":"\t\t}\n\t\treturn fmt.Errorf(\"review failed: %d of %d selected item(s) failed\",\n\t\t\tlen(manifest.Coverage.Failed), len(manifest.Coverage.Selected))\n\t}\n\treturn nil\n}\n\nfunc loadReviewResumeState(repoDir string, opts reviewOptions) (*session.ResumeState, error) {\n\tif opts.resume == \"\" {\n\t\treturn nil, nil\n\t}\n\tcurrent := session.SessionOptions{\n\t\tReviewMode: reviewModeFromOptions(opts),\n\t\tDiffFrom:   opts.from,\n\t\tDiffTo:     opts.to,\n\t\tDiffCommit: opts.commit,\n\t}\n\tif current.ReviewMode == session.ReviewModeWorkspace {\n\t\treturn nil, fmt.Errorf(\"resume requires --from/--to or --commit; workspace resume is not supported\")\n\t}\n\tstate, err := session.LoadReviewResumeState(repoDir, opts.resume)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"load resume session: %w (run 'ocr session list' to see available sessions)\", err)\n\t}\n\tif err := state.ValidateOptions(current); err != nil {\n\t\treturn nil, fmt.Errorf(\"%w (run 'ocr session list' to see available sessions)\", err)\n\t}\n\t// A parent whose every item failed is deliberately allowed through: it has a\n\t// verifiable manifest, so its whole selected set can simply be re-dispatched.\n\t// Whether the checkpoints may be reused at all is decided later, by\n\t// validateResumeIdentity, once the input identity is known.\n\treturn state, nil\n}\n\n// validateResumeIdentity rejects a resume whose input, rules, provider or model\n// no longer match the parent run.\n//","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/review_cmd.go#L332-L368","documentation":"Validation guard in loadReviewResumeState: `--resume` was given while the current review mode resolves to workspace (uncommitted changes review). Resume is only defined for a concrete diff scope — --from/--to or --commit — because the resume state must match the same item set; resuming a workspace review is unsupported by design.","triggerScenarios":"Thrown at cmd/opencodereview/review_cmd.go:350 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-run the review with --from/--to (diff range) or --commit instead of uncommitted workspace changes, then use --resume","Workspace-mode sessions cannot be resumed because the diff source is the live working tree","List sessions with 'ocr session list' and pick one that was created in a diff/commit mode"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}