claude-code - 💡(How to fix) Fix [BUG] Claude Desktop 2.1.121 silently truncates session transcript JSONL on resume; sidebar metadata survives, ~52 turns of history destroyed [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56649Fetched 2026-05-07 03:48:56
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4

Error Message

Opening an existing session in Claude Desktop silently truncates the session's transcript JSONL on disk, destroying prior conversation history while leaving the session metadata (title, creation date, completed-turn counter) intact in the sidebar. There is no warning, no confirmation prompt, and no error visible to the user. The assistant inside the session also has no signal that prior content is missing — from its perspective the session looks brand new. Additionally, the app should cross-check the JSONL body against the metadata sidecar's completedTurns counter before writing. If they disagree (sidebar says N turns, file body has zero), abort the write and warn the user.

Error Messages/Logs

No error or fall-through reason is logged between "Resuming session" and "Starting local session" — both states are reported as success. There is no log line indicating the resume failed. 2. Cross-check JSONL body length/content against sidecar completedTurns before writing; abort and warn on mismatch.

Root Cause

No error or fall-through reason is logged between "Resuming session" and "Starting local session" — both states are reported as success. There is no log line indicating the resume failed.

Code Example

~/Library/Logs/Claude/main.log, lines 1826918278:

2026-05-04 19:54:40 [info] [CCD] LocalSessions.setFocusedSession: sessionId=local_2469d7cb-305b-414e-ac9f-4b42c952c06b
2026-05-04 19:54:53 [info] LocalSessions.sendMessage: sessionId=local_2469d7cb-305b-414e-ac9f-4b42c952c06b, messageLength=33, imageCount=0
2026-05-04 19:54:53 [info] Resuming session local_2469d7cb-305b-414e-ac9f-4b42c952c06b in /Users/<user>/Desktop/claude/projects/LT
2026-05-04 19:54:53 [info] Starting local session local_2469d7cb-305b-414e-ac9f-4b42c952c06b in /Users/<user>/Desktop/claude/projects/LT
2026-05-04 19:54:53 [info] Mapping internal session local_2469d7cb-305b-414e-ac9f-4b42c952c06b to CLI session 01ce7efe-daac-485b-9faf-a674bd99e7c6

No error or fall-through reason is logged between "Resuming session" and "Starting local session" — both states are reported as success. There is no log line indicating the resume failed.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Opening an existing session in Claude Desktop silently truncates the session's transcript JSONL on disk, destroying prior conversation history while leaving the session metadata (title, creation date, completed-turn counter) intact in the sidebar. There is no warning, no confirmation prompt, and no error visible to the user. The assistant inside the session also has no signal that prior content is missing — from its perspective the session looks brand new.

Concrete incident: session "LT product brainstorm" (CLI id 01ce7efe-daac-485b-9faf-a674bd99e7c6), created 2026-03-22 with 52 completed turns of work. On opening it 2026-05-04 at 19:54 local, the underlying JSONL was rewritten to contain only the new turn. ~52 turns of conversation were destroyed.

The smoking gun is in ~/Library/Logs/Claude/main.log, where two log lines fire in the same second for the same session id on resume:

19:54:53 Resuming session local_2469d7cb-... 19:54:53 Starting local session local_2469d7cb-...

Eight other sessions opened on the same day in the same project show only the "Resuming session" line and retained their full history. Only the session with both lines was truncated. The metadata sidecar at ~/Library/Application Support/Claude/claude-code-sessions/<org>/<...>/local_2469d7cb-....json was untouched and still reports completedTurns: 52, which is why the sidebar continues to display the session as if nothing happened.

What Should Happen?

Resuming an existing session must preserve the JSONL on disk and append new turns. The "resume" code path must never open the JSONL with truncate semantics. If a resume cannot proceed for any reason, the app must surface the failure to the user and require explicit confirmation before doing anything destructive — never silently fall through to a fresh-start path that clobbers existing content.

Additionally, the app should cross-check the JSONL body against the metadata sidecar's completedTurns counter before writing. If they disagree (sidebar says N turns, file body has zero), abort the write and warn the user.

Error Messages/Logs

~/Library/Logs/Claude/main.log, lines 18269–18278:

2026-05-04 19:54:40 [info] [CCD] LocalSessions.setFocusedSession: sessionId=local_2469d7cb-305b-414e-ac9f-4b42c952c06b
2026-05-04 19:54:53 [info] LocalSessions.sendMessage: sessionId=local_2469d7cb-305b-414e-ac9f-4b42c952c06b, messageLength=33, imageCount=0
2026-05-04 19:54:53 [info] Resuming session local_2469d7cb-305b-414e-ac9f-4b42c952c06b in /Users/<user>/Desktop/claude/projects/LT
2026-05-04 19:54:53 [info] Starting local session local_2469d7cb-305b-414e-ac9f-4b42c952c06b in /Users/<user>/Desktop/claude/projects/LT
2026-05-04 19:54:53 [info] Mapping internal session local_2469d7cb-305b-414e-ac9f-4b42c952c06b to CLI session 01ce7efe-daac-485b-9faf-a674bd99e7c6

No error or fall-through reason is logged between "Resuming session" and "Starting local session" — both states are reported as success. There is no log line indicating the resume failed.

Steps to Reproduce

Repro is not yet deterministic, but the conditions are:

  1. Have an existing Claude Desktop session with substantial transcript history (jsonl with N>>0 prior turns) and a metadata sidecar showing completedTurns: N.
  2. Quit Claude Desktop completely.
  3. Relaunch Claude Desktop (version 2.1.121).
  4. Click the existing session in the sidebar.
  5. Send any message in that session.

Affected indicator: in ~/Library/Logs/Claude/main.log, the session's open shows BOTH log lines: "Resuming session <internal-id>" "Starting local session <internal-id>" in the same second. Sessions where only "Resuming session" appears are unaffected.

After step 5, inspect ~/.claude/projects/<encoded-cwd>/<cli-session-id>.jsonl. If the file's first entry is timestamped at the resume time (rather than the original session start), the transcript has been truncated.

In my incident, eight sibling sessions in the same project were opened the same way on the same day and survived intact — only one (01ce7efe) hit the buggy path. I cannot yet identify what differentiates the affected session from the unaffected ones.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Unknown

Claude Code Version

2.1.121 (embedded in Claude Desktop)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

Affected files on my machine:

  • Truncated transcript: ~/.claude/projects/-Users-<user>-Desktop-claude-projects-LT/01ce7efe-daac-485b-9faf-a674bd99e7c6.jsonl
  • Intact metadata sidecar (still shows the lost session's title, createdAt, completedTurns): ~/Library/Application Support/Claude/claude-code-sessions/<org>/<...>/local_2469d7cb-305b-414e-ac9f-4b42c952c06b.json
  • Smoking-gun log: ~/Library/Logs/Claude/main.log around line 18278

Asymmetry table — eight other sessions in the same project opened the same day, all retained their original first-message timestamps from March/April; only 01ce7efe lost its head and starts with a 2026-05-04 timestamp. Logs for those eight show only "Resuming session" with no paired "Starting local session" line.

Severity assessment: high. Silent destruction of user-generated content with no warning, no recovery path, and no integrity check between the two stores the app maintains (metadata sidecar vs transcript jsonl).

Suggested fixes:

  1. The "resume" code path must never open the JSONL with O_TRUNC. Append-only for resumes; truncate-write only for genuinely new sessions.
  2. Cross-check JSONL body length/content against sidecar completedTurns before writing; abort and warn on mismatch.
  3. Make resume failures explicit — prompt the user instead of silently falling through to a fresh-start path.
  4. Keep a rolling local backup of session JSONLs (last N versions in a sibling directory) so accidental destruction is recoverable.
  5. Surface a UI indicator when a session's body is shorter than its sidecar metadata implies, so the user notices on open instead of after typing.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Claude Desktop 2.1.121 silently truncates session transcript JSONL on resume; sidebar metadata survives, ~52 turns of history destroyed [1 participants]