Skip to content

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

Closed as duplicate

Description

@evertonresende

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

Activity

  1. github-actions commented on Jan 30, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. [BUG] Unbounded session file growth from verbose command output causes 100% CPU + OOM crash on ANY session start #21179
    2. [BUG] Session files grow unboundedly, causing OOM crash on startup ("Aborted (core dumped)") #20367
    3. Claude Code crashes with SIGABRT when session JSONL files exceed V8 heap limit #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

  2. pback34 commented on Jan 30, 2026

    @pback34

    i may have accidentally filed duplicate issue:
    #22057
    Also on ubuntu 24.04 (Pop!_OS) cosmic

  3. davidmoneil commented on Jan 31, 2026

    @davidmoneil

    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

  4. 1337hero commented on Jan 31, 2026

    @1337hero

    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.

  5. GLeonov commented on Jan 31, 2026

    @GLeonov

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

  6. hschmied commented on Jan 31, 2026

    @hschmied

    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.

  7. bharrison6 commented on Jan 31, 2026

    @bharrison6

    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!

  8. imkdw commented on Jan 31, 2026

    @imkdw

    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.

  9. bilbo-22 commented on Jan 31, 2026

    @bilbo-22

    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

  10. thieung commented on Jan 31, 2026

    @thieung
    Image

    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"
      }
    }
    
  11. mlarocque commented on Jan 31, 2026

    @mlarocque

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

  12. github-actions commented on Feb 8, 2026

    @github-actions

    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.

  13. locked as resolved and limited conversation to collaborators on Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions