CLI hangs at 99% CPU on startup with large session .jsonl files

Status Closed — duplicate
Reported on v2.1.27
Maintainer reply None cached
Activity 12 comments · opened Jan 30, 2026 · closed Jan 31, 2026

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

  1. Have a project with accumulated session files totaling ~19MB (one file was 11MB, another 4.7MB)
  2. Run claude or claude --print "hello" from the project directory
  3. 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 claude process 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

View original on GitHub ↗

12 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/21179
  2. https://github.com/anthropics/claude-code/issues/20367
  3. https://github.com/anthropics/claude-code/issues/19025

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

pback34 · 7 months ago

i may have accidentally filed duplicate issue:
https://github.com/anthropics/claude-code/issues/22057
Also on ubuntu 24.04 (Pop!_OS) cosmic

davidmoneil · 7 months ago

I'm experiencing the same issue on v2.1.27 (Linux). Additional findings:

  • Happens even with small session files (~47KB), not just large ones
  • Issue is directory-specific - same workflow works fine in other project directories
  • Removing project .claude/ directory, hooks, settings, git, CLAUDE.md didn't help - only clearing session files works

Workaround: rm -rf ~/.claude/projects/-home-username-ProjectName/* before starting

1337hero · 7 months ago

Additional Reproduction Data (Arch Linux)

Confirming this issue on a different Linux distribution with some additional observations.

Environment

  • Claude Code version: 2.1.27
  • OS: Arch Linux (kernel 6.18.7-zen1-1-zen)
  • Hardware: Observed 4 claude processes simultaneously

Observations

Multiple concurrent processes: When hanging, observed 4 separate claude processes, 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:

-rw------- 1 user user 3940 Jan 30 21:43 .claude.json.backup.1769834596303
-rw------- 1 user user 3977 Jan 30 21:43 .claude.json.backup.1769834596310
-rw------- 1 user user 4022 Jan 30 21:43 .claude.json.backup.1769834606894

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 .jsonl file.

Session file breakdown:

13M  ~/.claude/projects/-home-user/3dc5902a-f8bf-4161-8143-fdf019d7aabf.jsonl
8.4M ~/.claude/projects/-home-user/00d8c3dc-8ba7-4f5f-9f11-de5c64aff4c7.jsonl
6.2M ~/.claude/projects/-home-user/5e1231d2-8c32-4870-a5ae-f3fa88f9ee8e.jsonl

Workaround Confirmed

rm ~/.claude/projects/-home-user/*.jsonl

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.

GLeonov · 7 months ago

Same issue on MacOS 26.2 (25C56) & Claude Code version 2.1.27

hschmied · 7 months ago

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.

bharrison6 · 7 months ago

Confirming this issue on Ubuntu VPS

Environment: - Claude Code version: 2.1.27

  • Platform: Ubuntu 24.04 (VPS)
  • Session file location: ~/.claude/projects/

Symptoms:

  • Claude Code completely hangs on ANY command (even --help or non-interactive -p)
  • CPU usage: 120% (maxing out cores)
  • RAM usage: 5-6GB and climbing
  • Process state: Running but unresponsive, Ctrl+C has no effect
  • Required kill -9 to terminate

Session Files Causing the Issue:
I had 37 session files total, with these large ones triggering the hang:

  • 39MB session file
  • 32MB session file
  • 12MB session file
  • 9.5MB session file

Workaround:
Moving ALL .jsonl files from ~/.claude/projects/ to a backup directory immediately resolved the issue. Claude
Code 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:

  1. Graceful handling of large session files (pagination, lazy loading)
  2. Clear error message when files exceed a certain size
  3. Automatic archival/cleanup of old sessions

Happy to provide more debug info if needed!

imkdw · 7 months ago

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.

bilbo-22 · 7 months ago

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]/*.jsonl also works well for one time

thieung · 7 months ago

<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:

curl -fsSL https://claude.ai/install.sh | bash -s 2.1.25

Disable auto update:
Edit ~/.claude/settings.json

{
  "env": {
    "DISABLE_AUTOUPDATER": "1"
  }
}
mlarocque · 7 months ago

In my case doing a /resume in 2.1.27 definitely causes the freeze.

github-actions[bot] · 6 months ago

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.