Tool results embed full file content causing 'Prompt is too long' crashes
Bug Report — High Priority
Problem
Edit tool results store the full file content in the session JSONL, even though the visible response is just "The file has been updated successfully." Each edit to a large file (e.g., index.html) embeds ~1.4 MB of hidden content per tool result line.
After 5 edits to the same file, the session accumulates ~7 MB of invisible bloat. The session then hits "Prompt is too long" and becomes permanently hung — the user cannot send any more messages.
Impact
- Sessions crash and cannot recover without manual JSONL surgery
- The session file size (10 MB) appears small and well within limits, making the issue confusing to diagnose
- This happens frequently with iterative development workflows (editing the same file multiple times)
- Users lose hours of work and context
Reproduction
- Open a Claude Code session (VS Code or terminal)
- Make 5+ edits to a large file (e.g., a 200KB+
index.html) - Continue working — session will eventually return "Prompt is too long"
- Session is now permanently hung
Evidence
Session fb477cc6 — 775 lines, 10 MB total:
Line 445: 1,486,963 bytes — tool_result for index.html edit
Line 643: 1,488,335 bytes — tool_result for index.html edit
Line 645: 1,489,407 bytes — tool_result for index.html edit
Line 647: 1,487,195 bytes — tool_result for index.html edit
Line 668: 1,487,170 bytes — tool_result for index.html edit
Each line's visible content is just: "The file ... has been updated successfully."
But the JSONL line is ~1.4 MB — the full file content is embedded in the tool result metadata.
5 edits × 1.4 MB = 7.2 MB of hidden context that gets sent to the API on every request.
Expected Behavior
Edit tool results should only store the confirmation message, not the full file content. The file is already on disk — there is no need to embed it in the conversation history.
Environment
- Claude Code v2.1.39 (VS Code extension, macOS)
- Model: claude-opus-4-6
- macOS Darwin 25.2.0
Severity
High — this silently kills active working sessions with no recovery path for the user. It's especially bad because the session file size looks normal, making it very difficult to diagnose.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗