CLI hangs at 99% CPU on startup with large session .jsonl files
Bug Description
Claude Code CLI hangs indefinitely at 99% CPU usage on startup when the project has large session .jsonl files in ~/.claude/projects/<project-path>/.
Environment
- Claude Code version: 2.1.27
- OS: Ubuntu 24.04 LTS (kernel 6.8.0)
- Hardware: 8 cores, 24GB RAM
- Node.js: v24.13.0
Steps to Reproduce
- Have a project with accumulated session files totaling ~19MB (one file was 11MB, another 4.7MB)
- Run
claudeorclaude --print "hello"from the project directory - The process immediately spikes to 99% CPU and never responds
Expected Behavior
Claude Code should start normally, possibly with a slight delay for large sessions, or gracefully skip/truncate oversized session files.
Actual Behavior
- The
claudeprocess enters an infinite CPU loop at 99% - No output is produced (not even a prompt)
- The process never recovers — requires
kill -9 - Happens consistently on every launch from the affected project directory
Isolation Testing Performed
Systematically tested by removing components one at a time:
| Test | Result |
|------|--------|
| Empty directory (/tmp/claude-test) | ✅ Works |
| Parent directory (~/Development) | ✅ Works |
| Project dir without plugins | ❌ Hangs |
| Project dir without MCP servers | ❌ Hangs |
| Project dir without .git | ❌ Hangs |
| Project dir without node_modules (77k files) | ❌ Hangs |
| Project dir without CLAUDE.md | ❌ Hangs |
| Project dir without session .jsonl files | ✅ Works |
Root cause: Removing all .jsonl session files from ~/.claude/projects/<project-path>/ immediately resolves the issue.
Workaround
rm ~/.claude/projects/<project-path>/*.jsonl
rm -rf ~/.claude/projects/<project-path>/<session-uuid>
Suggestion
- Add a timeout or size limit for session file loading on startup
- Gracefully handle corrupted or oversized session files instead of entering a CPU loop
12 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
i may have accidentally filed duplicate issue:
https://github.com/anthropics/claude-code/issues/22057
Also on ubuntu 24.04 (Pop!_OS) cosmic
I'm experiencing the same issue on v2.1.27 (Linux). Additional findings:
Workaround: rm -rf ~/.claude/projects/-home-username-ProjectName/* before starting
Additional Reproduction Data (Arch Linux)
Confirming this issue on a different Linux distribution with some additional observations.
Environment
Observations
Multiple concurrent processes: When hanging, observed 4 separate
claudeprocesses, each pegged at 100% CPU and consuming ~71GB virtual memory.Race condition on config file: During the hang, rapid backup file creation occurred with timestamps 7ms apart:
Diffing these backups showed feature flags being incrementally added between writes, suggesting concurrent config modification.
Trigger: Launching from home directory (
~) where accumulated session files totaled ~40MB, including a 13MB.jsonlfile.Session file breakdown:
Workaround Confirmed
Immediately resolved the issue.
Additional Context
This appears to be a regression introduced in 2.1.27 — same workflow was stable on previous versions. The home directory is frequently used as a launch point for ad-hoc tasks, accumulating sessions over time.
Same issue on MacOS 26.2 (25C56) & Claude Code version 2.1.27
clearing ~/.claude/projects/* helped, but just for one session; every session after freezes again. reverted to 2.1.25 and so far it seems back to normal.
Confirming this issue on Ubuntu VPS
Environment: - Claude Code version:
2.1.27~/.claude/projects/Symptoms:
--helpor non-interactive-p)kill -9to terminateSession Files Causing the Issue:
I had 37 session files total, with these large ones triggering the hang:
Workaround:
Moving ALL
.jsonlfiles from~/.claude/projects/to a backup directory immediately resolved the issue. ClaudeCode now starts instantly. Restoring only small session files (<1MB) works fine.
Impact:
This makes Claude Code completely unusable when working on long-running projects that accumulate large session
histories. The hang happens during initialization before any user interaction, making it impossible to even access the
CLI.
Would be great to see either:
Happy to provide more debug info if needed!
I'm experiencing the same issue on macOS 26.2 (25C56).
So, I downgraded to version 2.1.20 and am using it for now.
I've been using it for about an hour and thankfully, it's still working fine.
I hope they fix it soon.
Same issue on crostini. removing the entire ~/.claude helped for the first session but then after one chat it's back again.
removing
rm ~/.claude/projects/[PATH]/*.jsonlalso works well for one time<img width="1542" height="188" alt="Image" src="https://github.com/user-attachments/assets/b95d711f-a1df-42a8-9d20-04be700ee7dd" />
Me too, downgrade to 2.1.25 works fine now.
Downgrade:
Disable auto update:
Edit ~/.claude/settings.json
In my case doing a
/resumein 2.1.27 definitely causes the freeze.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.