Session metadata corrupted on /exit - loses conversation context on resume
Resolved 💬 4 comments Opened Feb 1, 2026 by orangemelon69 Closed Mar 2, 2026
Bug Description
When using /exit to leave a session, the sessions-index.json metadata gets corrupted, causing the session to lose its conversation context when resumed.
Steps to Reproduce
- Have an active session with substantial conversation history
- Rename the session using
/rename <name> - Exit using
/exit - Resume the session (either automatically or via
/resume) - Result: Claude has no memory of the previous conversation
Root Cause Analysis
I debugged this issue and found the following:
Before /exit:
- Session JSONL file: 5,140 lines, 6.9 MB of conversation history
- Session started:
2026-01-31T20:03:36.916Z - Actual user messages: 326
After /exit - sessions-index.json was corrupted:
{
"sessionId": "b1eeadf9-3cac-4f43-9b95-f24302f55111",
"firstPrompt": "No prompt",
"summary": "User Exits Conversation",
"messageCount": 3,
"created": "2026-02-01T09:19:39.950Z"
}
Key Observations:
- The
createdtimestamp was overwritten to the exact time when/exitwas run - The
messageCountwas reset to3instead of the actual ~326 user messages - The
summarywas changed to "User Exits Conversation" - The
firstPromptwas set to "No prompt"
The session JSONL file still contains all 5,140 lines of conversation history - only the index metadata was corrupted.
Expected Behavior
createdshould preserve the original session creation timestampmessageCountshould reflect the actual number of messagessummaryshould not be overwritten with "User Exits Conversation"- On resume, Claude should have access to the full conversation history
Workaround
Manually editing ~/.claude/projects/<project>/sessions-index.json to restore the correct metadata values allows the session to be resumed with context.
Environment
- Claude Code version: 2.1.27 → 2.1.29 (upgraded during session)
- OS: macOS (Darwin 25.0.0)
- Session had custom hooks from plugins (beads workflow, etc.)
Impact
This is a significant issue because:
- Users lose hours of conversation context without warning
- The bug is silent - no error message indicates the corruption
- It happens during normal usage patterns (rename + exit + resume)
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗