Skip to content

Bug: <persisted-output> tool results are written to session JSONL at full size, causing session resume to hang #23948

Closed as duplicate

Description

@CatalanCabbage

Summary

When a Bash tool result exceeds the size threshold, Claude Code correctly saves the full output to a separate file under tool-results/ and wraps the content in <persisted-output> tags with a "Preview (first 2KB)" message. However, the full output is still serialized into the session JSONL file, making the session unloadable on resume.

Impact

The session JSONL grew to 12MB (728 lines), with two tool_result lines at ~5.2MB each. Attempting to /resume this session caused Claude Code to hang indefinitely.

Reproduction

  1. Start a Claude Code session
  2. Run a Bash command that produces very large output (e.g., grep on a large minified JS file — in this case, a 4.8MB webpack bundle)
  3. Claude Code correctly triggers the persisted-output path:
    • Saves full output to ~/.claude/projects/<project>/<session-id>/tool-results/<tool-use-id>.txt
    • The tool_result content starts with:
      <persisted-output>
      Output too large (4.8MB). Full output saved to: .../<tool-use-id>.txt
      
      Preview (first 2KB):
      ...
      
  4. Bug: Despite the "Output too large" message, the JSONL line for this tool_result still contains the full 5.2MB of content, not just the preview.
  5. Exit the session and try to /resume it — it hangs.

Evidence

  • Session file: ~/.claude/projects/-Users-dvsj/0153f518-29ff-486c-a353-8cf4333f10db.jsonl
  • Two offending lines (240 and 385) were type: "user" messages containing tool_result content
  • Both were 5,244,945 and 5,245,153 bytes respectively
  • The corresponding tool-results/*.txt files also exist at 4.9MB each, confirming the output was saved externally and duplicated in the session
  • The specific tool_use IDs: toolu_01TV61RJnJvVAhZXL8ZnVFfF and toolu_014hD6eeBkffWJHgoEScYySw
  • Both were Bash tool calls running grep on a large .webpack/main/index.js file

Expected behavior

When a tool result triggers the <persisted-output> path, the JSONL session file should only contain the truncated preview (first 2KB), not the full output. The full output is already saved to tool-results/<id>.txt.

Actual behavior

The JSONL session line contains the full multi-MB output despite the message claiming it was "saved to" an external file. This makes the session file grow to 10MB+ and causes /resume to hang.

Environment

  • Claude Code version: 2.1.17
  • Model: claude-opus-4-5-20251101
  • Platform: macOS (Darwin 24.5.0)

Workaround

Manually delete the offending lines from the .jsonl session file using sed -i '' '<line_number>d'. Identify large lines with:

awk '{print NR, length}' <session-file>.jsonl | sort -k2 -nr | head

Activity

  1. github-actions commented on Feb 7, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. Resume hangs indefinitely on sessions with large tool outputs #21067
    2. /resume command consistently crashing after the agent reads too big files, resulting in full unavailability of command and conversation history until fixed #16251
    3. [BUG] BASH_MAX_OUTPUT_LENGTH ignored after v2.1.2 — large outputs persisted to disk regardless of setting #17944

    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. added
    duplicateThis issue or pull request already exists
    and removed
    bugSomething isn't working
    has reproHas detailed reproduction steps
    platform:macosIssue specifically occurs on macOS
    on Feb 11, 2026
  3. github-actions commented on Feb 11, 2026

    @github-actions

    This issue has been automatically closed as a duplicate of #21067.

    If this is incorrect, please re-open this issue or create a new one.

    🤖 Generated with Claude Code

  4. github-actions commented on Feb 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.

  5. locked as resolved and limited conversation to collaborators on Feb 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

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions