{"record":{"id":"109a593f163dfc06","repo":"alibaba/open-code-review","slug":"read-resume-session-q-w","errorCode":null,"errorMessage":"read resume session %q: %w","messagePattern":"read resume session %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/session/resume.go","lineNumber":139,"sourceCode":"\n\tstate := &ResumeState{\n\t\tSessionID: sessionID,\n\t\tRepoDir:   repoDir,\n\t\tItems:     make(map[string]ResumeItem),\n\t}\n\treader := bufio.NewReader(f)\n\tfor {\n\t\tline, readErr := reader.ReadBytes('\\n')\n\t\tif len(line) > 0 {\n\t\t\tif err := state.applyResumeLine(line); err != nil && !skipUnparseable {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tif readErr == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif readErr != nil {\n\t\t\treturn nil, fmt.Errorf(\"read resume session %q: %w\", sessionID, readErr)\n\t\t}\n\t}\n\tif state.SessionID == \"\" {\n\t\tstate.SessionID = sessionID\n\t}\n\treturn state, nil\n}\n\n// applyResumeLine folds one record into the index. It reports an unparseable\n// line to the caller, which decides whether that is fatal.\nfunc (s *ResumeState) applyResumeLine(line []byte) error {\n\tvar rec resumeRecord\n\tif err := json.Unmarshal(line, &rec); err != nil {\n\t\treturn fmt.Errorf(\"parse resume session %q: %w\", s.SessionID, err)\n\t}\n\n\tswitch rec.Type {\n\tcase \"session_start\":","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/internal/session/resume.go#L121-L157","documentation":"loadResumeState wraps a non-EOF error from bufio ReadBytes while reading the session JSONL. It is thrown because an I/O failure mid-file means the checkpoint index may be incomplete and the library refuses to return a silently truncated state. EOF (normal end of file) is not an error and is excluded.","triggerScenarios":"Disk read error, file truncated or corrupted by a concurrent writer, I/O errors from failing storage, or the file being unreadable mid-stream (permissions changed while open).","commonSituations":"Machine crash or power loss left a partially written JSONL on a failing disk; NFS/network home directory dropped the connection mid-read; disk full or bad sectors.","solutions":["Re-run the load to rule out a transient I/O failure","Check disk health and free space on the volume holding ~/.opencodereview","If the file is corrupted, start a fresh review; the JSONL is not repairable","Copy the session file locally if HOME is on an unreliable network mount"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure the volume holding ~/.opencodereview is writable and has space\nif st, err := os.Stat(homeSessionDir); err != nil || !st.IsDir() { /* fix environment first */ }","typeGuard":null,"tryCatchPattern":"state, err := session.LoadResumeState(repoDir, sessionID)\nif err != nil {\n\tvar pe *fs.PathError\n\tif errors.As(err, &pe) && isTransientIO(pe) { retryLoad(3) }\n\treturn err\n}","preventionTips":["Keep ~/.opencodereview on local, healthy storage, not flaky network mounts","Monitor disk health and free space","Avoid running concurrent writers against the same session JSONL"],"tags":["go","file-io","io-error","resume"],"backgroundTag":"file-read-failure","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}