Repository navigation
Description
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?
Session history .jsonl files grow unbounded when Claude Code captures verbose command output. On subsequent startup or /resume, Claude Code loads the entire session file into memory, causing 80GB+ VIRT allocation and OOM crashes. In my case, a 3.6GB session file from captured e2fsck output crashed WSL2 repeatedly.
The corrupted/oversized session file affects ALL Claude Code instances, not just when resuming that specific session. Simply having a large .jsonl file in ~/.claude/projects/ causes:
- 100% CPU usage on single core (apparent infinite loop during startup)
- 80GB+ VIRT memory allocation
- OOM crash / WSL2 E_UNEXPECTED crash
This suggests Claude Code reads/processes ALL session files at startup, not just the active one.
What Should Happen?
Command output in session history should be truncated (e.g., cap at 100KB per command). Session files should have size limits. Large sessions should fail gracefully with a warning instead of OOM. Startup should not eagerly load multi-GB history into memory.
Error Messages/Logs
WSL2: Wsl/Service/E_UNEXPECTED
[process exited with code 4294967295 (0xffffffff)]
htop showed: VIRT 80.2G, MEM% 92.6, multiple claude processes
Offending file: 3.6GB single .jsonl
find ~/.claude/projects -type f -size +50M
/home/user/.claude/projects/-home-user/9f99474b-xxxx.jsonl (3.6GB)Steps to Reproduce
- Start Claude Code session in any directory
- SSH to remote server and run command with massive output (e.g.,
e2fsck -von filesystem with many errors, orcata huge log file) - Let session save automatically
- Exit Claude Code
- Start Claude Code again in same directory or use
/resume - Observe extreme memory consumption and crash/hang
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.1.19
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
Workaround: Delete oversized session files manually:
rm ~/.claude/projects/[project-dir]/[oversized-file].jsonl
The root cause is no size limit on captured command output in session history. Running 20+ concurrent Claude instances worked fine until one session captured verbose e2fsck output, creating the 3.6GB file.
Environment: WSL2 Ubuntu 24.04, 16GB RAM (7GB to WSL), Node v20.19.5
Related issues (but distinct behavior):
- [BUG] Crash: claude --resume causes JavaScript heap out of memory error #3178 - OOM on --resume (our bug affects fresh sessions too)
- [BUG] VS Code extension crashes with OOM error: conversation history accumulates to 700MB+ causing infinite crash loop #8722 - Accumulated history OOM (our bug is single 3.6GB file from command output)
Activity
dehengxu commentedon Jan 27, 2026
Same with you, and older version also hang and consume huge memory finally killed by sys
QuintinWillison commentedon Jan 27, 2026
I am genuinely confused as to what I just experienced. I used Claude (Web) to attempt to debug, and in the process it looks like a version
2.1.20release slipped in which fixes this! I had watched Claude Code get Killed for OOM (usingwatch -n 0.5 'free -h; echo; ps aux --sort=-%mem | head -5'in a discrete terminal session) and had even increased my Lima-provided Ubuntu VM that hosts Claude Code from 2GB to 4GB memory in case that might help. Only thing I might have done yesterday as a "mistake" was take Claude Code's warning/yellow instruction text at its word and runclaude install. My Terminal right now 🤯:QuintinWillison commentedon Jan 27, 2026
Just had version
2.1.20"Killed" (OOM, I presume) while engaging Opus for analysis on a new session. I had dropped my Ubuntu instance to just 2GB memory, but have now increased that back to 4GB. From this I conclude that Claude Code's memory footprint requirements have definitely increased since yesterday, as I was using it heavily yesterday all day with it never getting "Killed" - in fact, this morning was the first time I've encountered this after having been using Claude Code for a couple of months now!github-actions commentedon Feb 28, 2026
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
github-actions commentedon Mar 7, 2026
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.