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
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗