Session restore fails silently when sessions-index.json misses entries (Windows)
Resolved 💬 3 comments Opened Feb 6, 2026 by bosmadev Closed Feb 6, 2026
Description
Session resume (claude --resume "name" or /resume) frequently restores a blank/wrong session on Windows. Root cause investigation reveals 3 compounding issues:
Root Cause Analysis
1. Index Gap (Critical)
sessions-index.jsononly tracks 25 of 95 actual session files on disk- Orphaned
.jsonlfiles exist but are invisible to the resume picker - Likely caused by sessions ending abnormally or index write failures
2. Resume Only Matches customTitle
- The
Em()function in cli.js only searches thecustomTitlefield - Sessions without
/renameapplied are completely unfindable by name - No fallback to
summaryorfirstPrompt
3. /clear Creates Blank Shells
/clearpreserves the session ID and index entry but wipes all messages/renameafter/clearsets a customTitle on what is now an empty session- Resuming this session loads the blank shell instead of the original content
Reproduction Steps
- Start a new Claude Code session, do substantial work
- Run
/clearto clear the context - Run
/rename "MySession"to name it - Exit Claude Code
- Run
claude --resume "MySession" - Expected: Original session content restored
- Actual: Blank session with only post-clear messages
Environment
- Platform: Windows 11
- Claude Code: 2.1.34
- Node.js: 25.x
Related Issues
- #23610 — Session name overwritten after /resume
- #23421 — sessions-index.json stops updating
- #22614 — Incomplete session context loaded despite full file
- #23275 — /resume shows empty list (Windows)
Suggested Fix
- Index should be rebuilt/verified on startup or periodically
- Resume search should fall back to
summarywhen nocustomTitlematch /clearshould warn that resume will only restore post-clear content
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗