alibaba/open-code-review · error
resume session %q has no completed scan items (run 'ocr sess
Error message
resume session %q has no completed scan items (run 'ocr session list' to see available sessions)
What it means
A loaded resume state may legitimately contain zero completed scan items (every item failed or was retracted by review_item_failed). Resuming such a session has nothing to skip, so loadScanResumeState refuses with "resume session %q has no completed scan items". The scan cannot make progress from this checkpoint.
Source
Thrown at cmd/opencodereview/scan_cmd.go:261
return fmt.Errorf("scan failed: %w", err)
}
return emitRunResult(ctx, ag, comments, startTime, opts.outputFormat, opts.audience, q, llmIdentity, out, nil)
}
func loadScanResumeState(repoDir string, opts scanOptions, scanPaths []string) (*session.ResumeState, error) {
if opts.resume == "" {
return nil, nil
}
state, err := session.LoadResumeState(repoDir, opts.resume)
if err != nil {
return nil, fmt.Errorf("load resume session: %w (run 'ocr session list' to see available sessions)", err)
}
if err := state.ValidateScanOptions(scanPaths); err != nil {
return nil, fmt.Errorf("%w (run 'ocr session list' to see available sessions)", err)
}
if state.CompletedCount() == 0 {
return nil, fmt.Errorf("resume session %q has no completed scan items (run 'ocr session list' to see available sessions)", opts.resume)
}
return state, nil
}
func runScanPreview(cc *commonContext, scanTpl *template.ScanTemplate, scanPaths []string, outputFormat string, out io.Writer) error {
preview, err := scan.Preview(context.Background(), scan.Args{
RepoDir: cc.RepoDir,
Paths: scanPaths,
FileFilter: cc.FileFilter,
GitRunner: cc.GitRunner,
MaxFileSizeBytes: scanTpl.MaxFileSizeBytes,
// Template's prompt fields are unused by Preview; pass the same
// value so MaxFileSizeBytes is consistent.
Template: *scanTpl,
})
if err != nil {
return fmt.Errorf("scan preview failed: %w", err)
}View on GitHub (pinned to 5cf97d0d15)
Solutions
- Start a fresh `ocr scan` — there is nothing to resume from this session.
- Investigate why the original scan completed nothing (check provider auth/network via `ocr session show <id>` items).
- Pick a different session id from `ocr session list` that has completed items.
Defensive patterns
Strategy: fallback
Validate before calling
state, err := session.LoadResumeState(repoDir, opts.resume)
if err == nil && state.CompletedCount() == 0 {
return fmt.Errorf("session %s has no completed items; run a fresh scan", opts.resume)
} Type guard
func resumable(s *session.ResumeState) bool {
return s != nil && s.CompletedCount() > 0
} Try / catch
state, err := loadScanResumeState(repoDir, opts, scanPaths)
if err != nil {
log.Printf("resume unavailable (%v); starting fresh scan", err)
return executeScanFresh(opts) // fallback path
} Prevention
- Check `ocr session show <id>` item statuses before resuming.
- If the original scan completed nothing, fix the root cause (auth/network) first.
- Treat a zero-item resume as a signal to start fresh, not to retry blindly.
When it happens
Trigger: Running `ocr scan --resume <id>` where the session's JSONL contains no surviving review_item_done/review_item_reused records — all files failed, or failures retracted earlier completions.
Common situations: Resuming a scan that crashed on the very first file; a session where every attempt hit an LLM/network error so nothing was ever marked done; resuming an already fully-completed-and-retracted session.
Related errors
- load resume session: %w (run 'ocr session list' to see avail
- %w (run 'ocr session list' to see available sessions)
- list sessions: %w
- load session %q: %w
- sessions belong to different repositories: %s was recorded i
AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02).
Data as JSON: /api/errors/40358bb1cb2def52.
Report an issue: GitHub.