[BUG] [macOS GUI] Session file grows to 3.1 GB causing app crash and preventing new sessions
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?
Session file grew from 242 MB to 3.1 GB during a single session in the macOS GUI app, causing the application to become completely unusable. New sessions fail immediately with "Failed to load session" error.
Two related issues occurred:
- Prior to session bloat and new sessions failing, session history disappeared from UI despite being present in the JSONL file
- Attempting to recover by reading the session file via prompting found the session history file and may have caused the observed explosive file growth (242 MB → 3.1 GB with only ~81 new lines added) that may be related to new sessions now failing to load.
This may to be a recursive content storage bug triggered when Claude reads its own session history file, at least that's Claude's own speculative analysis within the one functioning session (the very one that grew explosively).
Claude's Own Hypothesis: When Claude reads its own session file, the content gets stored in the session as a tool result, creating recursive storage where the session contains itself.
What Should Happen?
- Session history should remain visible in the UI
- Session files should grow proportionally to actual content (~1-5 MB per message, not 35 MB per line)
- Large session files should not prevent new sessions from crashing/erroring out when created or prompts are sent.
- Reading session JSONL files should not cause recursive/exponential file growth--IF this was the root cause of the wild file growth in the first place.
- Application should remain usable even with large (100+ MB) sessions
Error Messages/Logs
**Error when creating new session:**
Failed to load session
[Button: Return to landing page]
**Session file details:**
File: 84136a99-4101-4066-ac68-095687ee3067.jsonl
Size: 3,107,182,551 bytes (3.1 GB)
Lines: 697
Average per line: ~4.4 MB
**Session index inconsistency:**
{
"sessionId": "84136a99-4101-4066-ac68-095687ee3067",
"messageCount": 16, // WRONG - actual session has hundreds of messages
"firstPrompt": "Will attempt restart...", // WRONG - actual first prompt was different
"created": "2026-01-17T03:49:41.526Z" // WRONG - actual creation was ~3 hours earlier
}
Steps to Reproduce
This is SPECULATION as I have NOT reproduced this. I don't know what caused the original session to "vanish" from the GUI in the first place (the session was listed, but the visible content appeared just like it was a fresh new session, nearly).
- Start a long-running session with extensive tool usage (Read, Write, Edit, Bash, Task)
- Session history disappears from UI (appears to be a separate bug) << GOOD LUCK reproducing this!
- User investigates by having Claude read its own session JSONL file (242 MB)
- Use Task tool with
general-purposesubagent to analyze the session file - Continue normal operations (reading files, creating documentation)
- Session file explodes from 242 MB → 3.1 GB (697 lines, ~4.4 MB per line)
- Try to create new session → immediate "Failed to load session" error -- NOTE: Session seems created in that it appears in the GUI's left column, but any prompts result in a "Failed to load session" full application foreground error that once one clicks on the button one is taken back to the main session list screen.
- Application becomes unusable
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.8
Platform
Other
Operating System
macOS
Terminal/Shell
Other
Additional Information
This was Claude Code as accessed NOT via terminal/shell nor by API (directly), but via MacOS Claude GUI's "Code" tab. So I'm not even sure if this is the correct place to report this bug.
Environment
- Claude Code Version: 2.1.8
- Client: macOS GUI application (not CLI)
- Platform: macOS Sequoia (Darwin 25.2.0)
- Architecture: Apple Silicon (M1)
- Date: 2026-01-17 to 2026-01-18
Additional context
Connection between issues
The history loss bug may have directly caused the file explosion:
- Session history disappeared from UI
- User asked Claude to investigate by reading session JSONL file (242 MB)
- Reading own session file may have triggered recursive storage
- Each read/analysis adds the entire session content as a tool result
- File grew 10x in size
- Application became unusable
Session activity during growth
- Reading scan images (JPG ~5096x6600 resolution) using Read tool
- Creating documentation files (markdown, txt, json)
- Using Task tool to spawn subagent for session analysis
- Heavy Read/Write/Edit/Bash tool usage
- Critical: Reading the session's own JSONL file multiple times
Files affected
/Users/username/.claude/projects/-Users-username-Claude-Code/
├── 84136a99-4101-4066-ac68-095687ee3067.jsonl (3.1 GB - BLOATED)
├── 54ef6827-4145-4589-99bb-a6814123da12.jsonl (4.3 KB - failed new session)
├── ae42cb0c-4af2-4e93-8784-021b8e332360.jsonl (84 KB - older working session)
└── sessions-index.json (incorrect metadata)
Workaround
- Close Claude Code completely
- Delete or move the bloated session file
- Restart Claude Code
- Context from original session is lost (though recoverable from file if needed)
Recommendations for developers
- Prevent recursive storage: Don't store full content of session JSONL files when read as tool results
- Limit tool result sizes: Truncate or summarize large tool results (>1 MB)
- Fix session index: Ensure sessions-index.json stays in sync with actual session files
- Session history UI: Fix UI not displaying full history when file is large
- File size monitoring: Warn when session files exceed 500 MB
- Graceful degradation: Large sessions shouldn't prevent new sessions from being created
- Subagent isolation: Consider limiting subagent access to parent session content
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗