{"record":{"id":"59bcafc57c631e3b","repo":"alibaba/open-code-review","slug":"w-run-ocr-session-list-to-see-available-sessio","errorCode":null,"errorMessage":"%w (run 'ocr session list' to see available sessions)","messagePattern":"%w \\(run 'ocr session list' to see available sessions\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/opencodereview/review_cmd.go","lineNumber":357,"sourceCode":"func 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//\n// It must run before agent.New: agent.New creates the session, and session.New\n// writes session_start immediately, so validating any later would leave an orphan\n// session on disk behind every rejection. It must also run after max-tokens is\n// resolved, because the per-file token ceiling decides which large diffs are\n// dropped and therefore which files the input identity covers.\n//\n// provider and model are explicit exactly when their flag was passed on this","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/review_cmd.go#L339-L375","documentation":"Generic wrap for a failed --resume load: the session exists but cannot be used because its recorded options (review mode, diff range, commit) do not match the current invocation, or the stored state is unreadable. The underlying cause is interpolated with %w plus the 'ocr session list' hint, so identity mismatches between the saved session and the requested resume are surfaced here.","triggerScenarios":"Thrown at cmd/opencodereview/review_cmd.go:357 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Follow the hint in the message: run 'ocr session list' to see available sessions","Verify the session ID passed to --resume exists and matches the current repo/mode identity","See the wrapped error for the root cause (missing file, corrupted state, identity mismatch)"],"exampleFix":null,"handlingStrategy":"try-catch","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"}