Description
After upgrading from Claude Code v2.1.15 to v2.1.24+ (and later 2.1.34), some sessions only show the last message when resumed, with all prior conversation history missing. The history is present in the JSONL file but not loaded by Claude Code.
Note: Downgrading back to v2.1.15 does NOT fix the issue, indicating the corruption happened at write time, not at read time.
Update: I'm still getting this occasionally (so it wasn't version-switch related)
Symptoms
- Resume a session → only see the last message
- Full conversation history exists in the
.jsonl file
- Affects some sessions but not others (no clear version pattern)
Investigation
Had Claude analyze a working session vs. a broken session. Found two corruption issues in the broken session's JSONL file:
1. Snapshot messageId Collision
file-history-snapshot entries have messageId values that collide with the immediately following message's uuid, creating ID ambiguity:
- Line 53: snapshot with
messageId: "5c1312fa-..."
- Line 54: user message with
uuid: "5c1312fa-..." (same ID!)
2. Broken Parent Chain Reference ⚠️ This is the critical bug
An entry references a parent UUID that doesn't exist in the file, breaking conversation chain traversal:
- Line 50:
progress entry with parentUuid: "1b366c02-..."
- No entry in the file has
uuid: "1b366c02-..."
- Should point to the previous entry:
uuid: "97fdd911-..."
This broken link prevents Claude Code from traversing the conversation history backwards when loading the session. When traced back from the last message, the chain stops at this broken reference after only 6 entries instead of going back through all 26 entries in the conversation.
Root Cause
Unknown what causes the corruption during writing. Possibly related to:
- Sessions being open during version upgrade
- Specific timing/race conditions
- Not all sessions affected (sporadic issue)
Workaround
Created a Nushell script that detects and fixes both issues:
- Sets snapshot
messageId to null (removes collision)
- Fixes broken parent references to point to correct preceding entries
- Creates timestamped backups (non-destructive)
Fix script: https://gist.github.com/tennox/90ef5c803ec4b64c9fbba0f71ca1ae2e
nu fix-cc-session.nu ~/.config/claude/projects/YOUR-PROJECT/SESSION-ID.jsonl
Environment
- Upgraded from: v2.1.15
- Upgraded to: v2.1.24, then v2.1.34
- OS: Linux (NixOS)
- Pattern: Some sessions affected, others not (no clear correlation with version)
Expected Behavior
Resuming a session should load the full conversation history, regardless of which version created the session.
Actual Behavior
Only the last message is displayed; all prior history is invisible despite being present in the JSONL file.
Description
After upgrading from Claude Code v2.1.15 to v2.1.24+ (and later 2.1.34), some sessions only show the last message when resumed, with all prior conversation history missing. The history is present in the JSONL file but not loaded by Claude Code.
Note: Downgrading back to v2.1.15 does NOT fix the issue, indicating the corruption happened at write time, not at read time.
Update: I'm still getting this occasionally (so it wasn't version-switch related)
Symptoms
.jsonlfileInvestigation
Had Claude analyze a working session vs. a broken session. Found two corruption issues in the broken session's JSONL file:
1. Snapshot
messageIdCollisionfile-history-snapshotentries havemessageIdvalues that collide with the immediately following message'suuid, creating ID ambiguity:messageId: "5c1312fa-..."uuid: "5c1312fa-..."(same ID!)2. Broken Parent Chain Reference⚠️ This is the critical bug
An entry references a parent UUID that doesn't exist in the file, breaking conversation chain traversal:
progressentry withparentUuid: "1b366c02-..."uuid: "1b366c02-..."uuid: "97fdd911-..."This broken link prevents Claude Code from traversing the conversation history backwards when loading the session. When traced back from the last message, the chain stops at this broken reference after only 6 entries instead of going back through all 26 entries in the conversation.
Root Cause
Unknown what causes the corruption during writing. Possibly related to:
Workaround
Created a Nushell script that detects and fixes both issues:
messageIdtonull(removes collision)Fix script: https://gist.github.com/tennox/90ef5c803ec4b64c9fbba0f71ca1ae2e
nu fix-cc-session.nu ~/.config/claude/projects/YOUR-PROJECT/SESSION-ID.jsonlEnvironment
Expected Behavior
Resuming a session should load the full conversation history, regardless of which version created the session.
Actual Behavior
Only the last message is displayed; all prior history is invisible despite being present in the JSONL file.