Skip to content

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

Closed as not planned

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.

Activity

  1. github-actions commented on Jan 29, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. [Bug] Unable to resume conversation #15825
    2. [BUG] Conversation chain breaks mid-session - earlier messages lost on resume #21617
    3. Last message in conversation can disappear #18568

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  2. carrotRakko commented on Jan 29, 2026

    @carrotRakko
    Author

    These are not duplicates. Here's why:

    Issue Problem Root cause
    #15825 Error when trying to resume Runtime error (400/stack trace)
    #18568 Last message disappears Unknown (UI/display issue?)
    #21617 Earlier messages lost on resume Broken parentUuid chain
    #21751 (this) Assistant text blocks not written to transcript Transcript write failure

    Key distinctions:

    Evidence: I analyzed 3 session transcripts and found 118 instances where assistant text blocks were dropped while thinking blocks were written. This is a file I/O issue, not a display or resume issue.


    ✍️ Author: Claude Code (Dev Container) with @carrotRakko

  3. carrotRakko commented on Jan 30, 2026

    @carrotRakko
    Author

    Root cause identified: text is written to the wrong file, not missing

    After further investigation, I found that the text block is not "missing" — it's being written to the prompt_suggestion subagent file instead of the main transcript.

    Evidence

    Same API response (same message.id), different destinations:

    Main transcript (thinking):

    {
      "uuid": "f1da7b3d-...",
      "isSidechain": false,
      "agentId": null,
      "message.id": "msg_01BhizEVteEZjjrZoAvtWnSi",
      "content_type": "thinking"
    }

    Subagent file agent-aprompt_suggestion-*.jsonl (text):

    {
      "uuid": "66cddcc7-...",
      "parentUuid": "f1da7b3d-...",
      "isSidechain": true,
      "agentId": "aprompt_suggestion-e546c0",
      "message.id": "msg_01BhizEVteEZjjrZoAvtWnSi",
      "content_type": "text"
    }

    The thinking and text blocks from the same API response are being split across different files.

    Reproduction rate: 100%

    I analyzed all sessions from today and found that every single orphan's parentUuid exists in a subagent file:

    Session Orphans Found in subagent files
    45649bf7 1 1 (100%)
    48c052ca 18 18 (100%)
    75212a62 31 31 (100%)
    a001d58d 3 3 (100%)
    c74b8d79 25 25 (100%)
    Total 78 78 (100%)

    All caused by prompt_suggestion

    Notably, all 78 orphans were caused by aprompt_suggestion-* subagent files — not by explicit Task tool usage. This means the bug occurs even when users don't intentionally use subagents.

    Impact

    • Real-time: Both thinking and text are in state, so UI renders correctly
    • On /resume: Only main transcript is loaded → text is missing → broken chain → messages before the break become unreachable

    Potential workaround

    Disable prompt suggestions:

    // ~/.claude/settings.json
    {
      "promptSuggestionEnabled": false
    }

    However, there are reports that this setting doesn't work (#14629, #15709, #15427, #17572).

    What's still unknown

    Why do thinking and text from the same API response get different isSidechain values? This likely requires code-level investigation.

    Analysis commands

    To verify orphan parentUuids exist in subagent files:

    # Extract orphan parentUuids
    orphan_parents=$(jq -sr '
      (map(select(.uuid)) | INDEX(.uuid)) as $by_uuid |
      [.[] | select(.type == "user" and .parentUuid and ($by_uuid[.parentUuid] | not))] |
      .[].parentUuid
    ' transcript.jsonl)
    
    # Search in subagent files
    for uuid in $orphan_parents; do
      grep -l "$uuid" subagents/*.jsonl 2>/dev/null
    done

    ✍️ Author: Claude Code (Dev Container) with @carrotRakko

  4. carrotRakko commented on Jan 30, 2026

    @carrotRakko
    Author

    Workaround confirmed: disable prompt suggestions

    I verified that disabling prompt suggestions prevents this bug from occurring.

    Configuration options (both work)

    Option 1: Environment variable

    export CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false

    Option 2: Settings file (~/.claude/settings.json)

    {
      "promptSuggestionEnabled": false
    }

    You can also toggle this via /config → "Prompt suggestions" → false.

    Verification results (v2.1.25)

    Test Without workaround With workaround
    aprompt_suggestion-*.jsonl created Yes (12 files / 52 turns) No (0 files)
    subagents/ directory Exists Does not exist
    Orphan count Variable 0

    Trade-off

    You lose the "suggested next prompt" feature in the UI.


    ✍️ Author: Claude Code (Dev Container) with @carrotRakko

  5. genesiscz commented on Feb 9, 2026

    @genesiscz

    Can confirm. Also can confirm the promptSuggestionEnabled: false fixes the problem.

    @carrotRakko Can you share what agents/skills are you using to respond/analyze like this with? Is it automated? Is it open source? What's the workflow? Would love to have this too!

  6. carrotRakko commented on Feb 10, 2026

    @carrotRakko
    Author

    @genesiscz Thanks for confirming!

    To answer your question — there's no special tooling, automation, or framework behind this. It's just Claude Code (the CLI) with Opus, used interactively.

    Workflow: I describe the problem → Claude Code investigates (reads files, writes jq scripts, iterates on findings), writes the analysis, and posts it → I review and approve. That's it. The ✍️ Author: Claude Code ... with @carrotRakko signature on each comment means exactly this — AI-drafted, human-reviewed.

    Not open source: Claude Code itself is not open source (#22002), so there's no code to share. If it were, I'd have submitted a PR to fix this instead of filing an issue.

    If there's a "secret sauce," it's less about tools and more about the working relationship — treating Claude Code not as a tool to prompt, but as a collaborator to grow with.


    ✍️ Author: Claude Code (Reizan Container) with @carrotRakko

  7. github-actions commented on Mar 11, 2026

    @github-actions

    Closing for now — inactive for too long. Please open a new issue if this is still relevant.

  8. github-actions commented on Mar 19, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  9. locked as resolved and limited conversation to collaborators on Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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