{"record":{"id":"13cb4d47c806613e","repo":"alibaba/open-code-review","slug":"load-session-q-w","errorCode":null,"errorMessage":"load session %q: %w","messagePattern":"load session %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/opencodereview/session_cmd.go","lineNumber":183,"sourceCode":"\t\treturn enc.Encode(summaries)\n\t}\n\n\tif len(summaries) == 0 {\n\t\tfmt.Printf(\"No sessions found for %s\\n\", resolvedRepo)\n\t\treturn nil\n\t}\n\tprintSessionTable(os.Stdout, summaries)\n\treturn nil\n}\n\nfunc runSessionShow(sessionID string) error {\n\tresolvedRepo, err := resolveWorkingDirForSession(sessionShowRepoDir)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsummary, items, err := session.LoadDetail(resolvedRepo, sessionID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"load session %q: %w\", sessionID, err)\n\t}\n\n\tif sessionShowJSON {\n\t\tpayload := struct {\n\t\t\tSummary *session.Summary     `json:\"summary\"`\n\t\t\tItems   []session.ItemDetail `json:\"items\"`\n\t\t}{Summary: summary, Items: items}\n\t\tenc := json.NewEncoder(os.Stdout)\n\t\tenc.SetIndent(\"\", \"  \")\n\t\treturn enc.Encode(payload)\n\t}\n\n\tprintSessionDetail(os.Stdout, summary, items)\n\treturn nil\n}\n\nfunc runSessionComments(sessionID string) error {\n\tresolvedRepo, err := resolveWorkingDirForSession(sessionCommentsRepoDir)","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/session_cmd.go#L165-L201","documentation":"`ocr session show <id>` loads the session summary plus per-file item records via session.LoadDetail. If the session file is missing for this repo, the id is wrong, or the JSONL cannot be parsed/walked, the CLI wraps it as \"load session %q: %w\".","triggerScenarios":"Running `ocr session show <id>` with an id that doesn't exist in this repo's session store, or whose JSONL is truncated/corrupted so LoadDetail fails mid-walk.","commonSituations":"Copy-pasting a partial session id; showing a session from a different repository (store is keyed by repo path); inspecting a session whose file was truncated by a hard kill.","solutions":["Run `ocr session list` in the same repo and use an exact id from the output.","Verify you're in the repository where the session was created.","If the JSONL is corrupted (inner parse error), restore from backup or treat the session as lost.","Check ~/.opencodereview/sessions/<encoded-repo>/<id>.jsonl exists."],"exampleFix":"// before\nocr session show 3f9a\n// after\nocr session list\nocr session show 3f9a1b2c-4d5e-6f70-a1b2-c3d4e5f60718","handlingStrategy":"validation","validationCode":"ids := mustListSessions(repoDir) // via session.ListSessions\nif !contains(ids, sessionID) {\n    return fmt.Errorf(\"session %q not found in this repo; available: %v\", sessionID, ids)\n}","typeGuard":"func sessionExists(repoDir, id string) bool {\n    p, err := session.SessionFilePath(repoDir, id)\n    if err != nil { return false }\n    _, err = os.Stat(p)\n    return err == nil\n}","tryCatchPattern":"summary, items, err := session.LoadDetail(resolvedRepo, sessionID)\nif err != nil {\n    if errors.Is(err, fs.ErrNotExist) {\n        return fmt.Errorf(\"no session %q here; try `ocr session list`\", sessionID)\n    }\n    return fmt.Errorf(\"session file unreadable: %v\", err) // parse failure path\n}","preventionTips":["Copy exact full session ids from `ocr session list`.","Run session commands from the repository that created the session.","Back up session JSONL before force-killing ocr mid-run."],"tags":["go","cli","session"],"backgroundTag":"session-file-not-found","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}