alibaba/open-code-review · error
read resume session %q: %w
Error message
read resume session %q: %w
What it means
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.
Source
Thrown at internal/session/resume.go:139
state := &ResumeState{
SessionID: sessionID,
RepoDir: repoDir,
Items: make(map[string]ResumeItem),
}
reader := bufio.NewReader(f)
for {
line, readErr := reader.ReadBytes('\n')
if len(line) > 0 {
if err := state.applyResumeLine(line); err != nil && !skipUnparseable {
return nil, err
}
}
if readErr == io.EOF {
break
}
if readErr != nil {
return nil, fmt.Errorf("read resume session %q: %w", sessionID, readErr)
}
}
if state.SessionID == "" {
state.SessionID = sessionID
}
return state, nil
}
// applyResumeLine folds one record into the index. It reports an unparseable
// line to the caller, which decides whether that is fatal.
func (s *ResumeState) applyResumeLine(line []byte) error {
var rec resumeRecord
if err := json.Unmarshal(line, &rec); err != nil {
return fmt.Errorf("parse resume session %q: %w", s.SessionID, err)
}
switch rec.Type {
case "session_start":View on GitHub (pinned to 5cf97d0d15)
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
Defensive patterns
Strategy: retry
Validate before calling
// ensure the volume holding ~/.opencodereview is writable and has space
if st, err := os.Stat(homeSessionDir); err != nil || !st.IsDir() { /* fix environment first */ } Try / catch
state, err := session.LoadResumeState(repoDir, sessionID)
if err != nil {
var pe *fs.PathError
if errors.As(err, &pe) && isTransientIO(pe) { retryLoad(3) }
return err
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- open resume session %q: %w
- read app config %s: %w
- load resume session: %w (run 'ocr session list' to see avail
- %w (run 'ocr session list' to see available sessions)
- resume session %q has no completed scan items (run 'ocr sess
AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02).
Data as JSON: /api/errors/109a593f163dfc06.
Report an issue: GitHub.