Skip to content

[BUG] Assistant text messages not written to transcript - only thinking blocks persist #21751

Description

@carrotRakko

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?

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:

  1. The next user message references a parentUuid that doesn't exist in the transcript
  2. The conversation chain breaks silently
  3. 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

  1. Have a normal conversation with Claude Code (Opus with extended thinking)
  2. After several exchanges, analyze the transcript JSONL file
  3. Search for user messages whose parentUuid doesn't exist in the file
  4. Check the preceding assistant message - it will contain only thinking, no text

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corebugSomething isn't workinghas reproHas detailed reproduction stepsmemoryplatform:linuxIssue specifically occurs on LinuxstaleIssue is inactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions