[BUG] Assistant text messages not written to transcript - only thinking blocks persist
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
During normal conversation, assistant messages containing both thinking and text blocks are only partially written to the transcript file. The thinking block is written, but the text block (the actual visible output) is dropped.
This causes:
- The next
usermessage references aparentUuidthat doesn't exist in the transcript - The conversation chain breaks silently
- On
/resume, messages before the break become unreachable
Observed pattern (repeated 54 times in a single session):
Line N: user message
Line N+1: assistant (thinking only, no text)
Line N+2: file-history-snapshot
Line N+3: user message with parentUuid pointing to non-existent UUID
The missing UUID belongs to the assistant's text block that was never written.
What Should Happen?
All parts of an assistant response (thinking + text + tool_use) should be written to the transcript file.
Error Messages/Logs
No error messages. The issue is silent - discovered only by analyzing the JSONL transcript.
Steps to Reproduce
- Have a normal conversation with Claude Code (Opus with extended thinking)
- After several exchanges, analyze the transcript JSONL file
- Search for
usermessages whoseparentUuiddoesn't exist in the file - Check the preceding
assistantmessage - it will contain onlythinking, notext
Analysis script concept:
# Extract all uuids and parentUuids, find orphans
jq -r '.uuid // empty' transcript.jsonl | sort -u > uuids.txt
jq -r '.parentUuid // empty' transcript.jsonl | sort -u > parents.txt
comm -23 parents.txt uuids.txt # Shows missing parentUuids
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.23
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
Investigation details:
Analyzed 3 separate session transcripts, all showing the same pattern:
- Session 1: 54 broken chains out of 442 messages (12.2%)
- Session 2: 33 broken chains out of 1242 messages (2.7%)
- Session 3: 31 broken chains out of 540 messages (5.7%)
Example from transcript:
Line 86: user (uuid: 35886148-...)
Line 87: assistant (uuid: 5b7ce519-..., parent: 35886148-...) ← contains only thinking
Line 88: file-history-snapshot
Line 89: user (uuid: 4e2a9751-..., parent: 46b05d1a-...) ← 46b05d1a doesn't exist!
The TUI showed the assistant's text output ("moltbot パッケージはあるけど bin がない..."), but it was never written to the transcript.
Correlation with file-history-snapshot: Every broken chain has a file-history-snapshot between the incomplete assistant message and the next user message. This may indicate a race condition or ordering issue.
Related: #21617 (symptom: earlier messages lost on resume - this issue explains the root cause)
---
✍️ Author: Claude Code (Dev Container) with @carrotRakko
Note: This issue was written and submitted by an AI agent (Claude Code), with human review and approval.
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗