[BUG] Critical memory regression in 2.1.27 - OOM crash on simple input
Resolved 💬 65 comments Opened Jan 30, 2026 by Profreshor Closed Jan 31, 2026
💡 Likely answer: A maintainer (dicksontsai, collaborator)
responded on this thread — see the highlighted reply below.
Bug Description
Version 2.1.27 has a critical memory regression causing immediate OOM kills on even trivial input. Rolling back to 2.1.25 resolves the issue completely.
Reproduction Steps
- Update to Claude Code 2.1.27
- Launch
claudein terminal - Type "Test" and press Enter
- Process balloons to 7.5GB RAM in ~20 seconds and gets OOM killed
Expected Behavior
Claude Code should handle simple input without excessive memory consumption, as it did in 2.1.25.
Actual Behavior
Memory consumption explodes from ~467MB to 7.5GB within 20 seconds of sending a single word, exhausting all available RAM + swap and triggering the Linux OOM killer.
Evidence
Memory comparison between versions
| Version | Behavior after typing "Test" |
|---------|------------------------------|
| 2.1.27 | 467MB → 7.5GB in 20 sec → OOM killed |
| 2.1.25 | ~540-555MB, stable |
dmesg OOM killer logs (2.1.27)
[Fri Jan 30 15:40:20 2026] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/session-2973.scope,task=claude,pid=2629268,uid=1000
[Fri Jan 30 15:40:20 2026] Out of memory: Killed process 2629268 (claude) total-vm:86031684kB, anon-rss:7510204kB, file-rss:2304kB, shmem-rss:0kB, UID:1000 pgtables:21288kB oom_score_adj:0
Memory monitoring during 2.1.27 session
# Baseline at launch
curtis 2629268 3.9 5.7 74631248 467256 pts/0 Sl+ 15:38 0:02 claude
Mem: 7.7Gi total, 1.3Gi used, 6.1Gi free
# +15 seconds later
curtis 2629268 15.1 61.5 79740216 4988860 pts/0 Rl+ 15:38 0:14 claude
Mem: 7.7Gi total, 5.6Gi used, 1.7Gi free
# +5 more seconds: OOM killed
2.1.25 after rollback (stable)
curtis 2630338 30.0 6.7 81149672 549984 pts/0 Sl+ 15:41 0:10 claude
Mem: 7.7Gi total, 1.4Gi used, 5.0Gi free
# Remained stable at ~550MB
Workaround
Roll back to 2.1.25:
ln -sf ~/.local/share/claude/versions/2.1.25 ~/.local/bin/claude
Environment Info
- Platform: Linux (Ubuntu 24.04, kernel 6.8.0-90-generic)
- Architecture: x86_64 (QEMU/KVM VM)
- RAM: 8GB + 4GB swap
- Terminal: VSCode integrated terminal (Remote SSH)
- Affected Version: 2.1.27
- Working Version: 2.1.25
- MCP Servers: playwright-mcp, mcp-obsidian (were loading at time of crash, but crash occurs regardless)
Additional Context
- This VM has been running heavy Claude Code sessions for weeks without issue on earlier versions
- Previously ran 4 concurrent Claude Code terminals without problems
- The issue is 100% reproducible on 2.1.27 and 100% resolved by rolling back to 2.1.25
- Multiple OOM kills observed in a single debugging session, all with the same pattern
65 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Update: Potential Node.js version correlation
After further investigation, I have another VM running 2.1.27 without the memory issue. Key difference:
| Environment | Node.js | Claude 2.1.27 Behavior |
|-------------|---------|------------------------|
| VM with crash | v24.12.0 | OOM killed at 7.5GB |
| VM without crash | v22.22.0 | Stable at ~557MB |
Both VMs have similar Claude configs and project context sizes (~1.1-1.3GB). The crashing VM has 8GB RAM, the stable one has 39GB - but the stable one isn't even approaching the memory levels seen on the crashing VM.
This may be a Node.js 24 compatibility issue rather than a universal 2.1.27 regression.
Update: Confirmed 2.1.27 specific, not Node.js related
Further testing:
~/.claude/session-env) - still crashed on 2.1.27The issue is definitively 2.1.27 on this specific VM. Another VM (39GB RAM, same Node 22) runs 2.1.27 fine at ~557MB, so there may be an environmental factor triggering the regression, but it's not Node version or session state.
Staying on 2.1.25 as workaround.
It happens to me with the native binary as well. Once
claudeis launched, CPU is skyrocketing to 100%. What I can do is to force close it via Activity Monitor.Update: Confirmed - bug is triggered by SECOND concurrent session
After extensive testing across two different VMs:
| Scenario | Result |
|----------|--------|
| First Claude session (any directory) | ✅ Stable ~500MB |
| Second concurrent session | ❌ Memory balloons to 7.5GB+, OOM/freeze |
This reproduces on:
Both VMs running 2.1.27. The issue is not related to:
The bug is specifically triggered when launching a second Claude Code instance while another is already running.
Single-session usage appears stable. Multi-terminal workflows are broken.
can confirm, wont even get an output, it just hangs
Update: Additional bug - 3rd concurrent session hangs (affects 2.1.25 AND 2.1.27)
After further testing, there's a separate issue from the memory explosion:
Reproduction:
This affects both 2.1.25 and 2.1.27 - tested after fresh VM reboot with clean memory state.
Characteristics:
Summary of bugs found:
Current workaround: Maximum 2 concurrent Claude Code sessions per machine, running 2.1.25.
ROOT CAUSE IDENTIFIED: Corrupted
saved_hook_contextrecords in session filesAfter extensive binary search debugging, found that session files containing
saved_hook_contextrecords cause Claude Code to hang in a CPU spin loop on startup.Corrupted files found:
saved_hook_contextentriesPattern: All corrupted files were created/modified today after updating the Anthropic plugin marketplace and enabling the
playgroundplugin. Files with 0saved_hook_contextrecords work fine.The bug appears to be:
explanatory-output-style) are writing duplicatesaved_hook_contextrecords to session filesWorkaround: Delete session files containing
saved_hook_contextrecords, or nuke~/.claudeentirely and start fresh.Affected: This explains both the memory explosion (trying to process hundreds of hook contexts) and the CPU spin (infinite loop processing them).
This is NOT a duplicate of the linked issues.
The suggested duplicates are different problems:
| Issue | Root Cause | Timing |
|-------|------------|--------|
| #21220 | Project indexing memory leak (110K+ files) | During indexing |
| #21403 | Gradual memory leak over 30min-2hr sessions | During operation |
| #21378 | Cache/history accumulation (9.6M tokens) | After weeks of use |
| #22042 (this) | Corrupted
saved_hook_contextin session files | Instant on startup |Key differences:
saved_hook_contextrecordssaved_hook_contextrecordsThe other issues are gradual memory leaks during normal operation. This issue is a parsing/loading bug that causes instant CPU spin loops when loading session history with malformed hook context data.
This needs separate tracking as it has a distinct root cause and fix path.
can confirm this bug, hope they will fix asap.
Diagnostic for others experiencing this issue:
If you're seeing 100% CPU on startup or instant memory explosion, check if you have corrupted session files:
Fix: Delete any files with excessive
saved_hook_contextrecords, or if you want a clean slate:I'm not having the CPU issue. It's just not responding, it just hangs.
that's the cpu issue :)
Activity Monitor shows otherwise. weird
use btop
This is also killing our automated PR review processes which are crashing midway through sessions since this version was released.
Tip for those still on the npm version:
You can disable auto-updates and pin to a working version:
1. Disable auto-updates by adding this to
~/.claude/settings.json:(Merge with your existing settings if you have them)
2. Reinstall the last working version:
3. Verify:
New sessions will now stay pinned. When a fix is released, remove the env var and restart claude
Update: Confirmed the root cause on my end too
@Profreshor thanks for the incredible detective work on this - your diagnostic saved me a lot of headache.
Ran your check and found 4 corrupted session files on my machine (macOS). The worst one had 254
saved_hook_context entries, others had 28, 13, and 7.
In my case, I have custom hooks configured globally in ~/.claude/settings.json that listen to multiple
events - SessionStart, SessionEnd, Stop, Notification, UserPromptSubmit, and a PreToolUse with matcher: "*".
That PreToolUse wildcard hook fires on every single tool call Claude makes, so the saved_hook_context
records were accumulating at a much faster rate than a typical setup. A single session with heavy tool usage
was enough to balloon a session file to hundreds of duplicate hook context entries.
The result was exactly what you described - CPU spin on startup as Claude Code tried to parse and process
these bloated session JSONL files. Deleted the corrupted files and everything is back to normal on 2.1.25.
Staying pinned there until this gets a proper fix upstream.
Thank you for the temporary fix. It works perfectly. No issues. Everybody should follow ths for the time being and downgrade to 2.1.25.
confirming by deleting this the hang goes away. I used superpowers which added a session start hook. by disabling it temporarily fixed it.
same issue, disabled superpowers plugin but didn't help. With 2.1.25 works fine
This worked for me:
This actually worked for 2.1.27 Thanks
Additional data point: macOS Tahoe (26.x) + Apple Silicon
Confirming this issue on macOS:
"autoUpdatesChannel": "stable")~/.local/share/claude/)Corrupted files found:
saved_hook_contextentries across 5 session filesPlugins with hooks enabled:
Key observation: These are simple lifecycle hooks (SessionStart, Stop), NOT wildcard PreToolUse hooks. The accumulation is happening
even with hooks that should only fire once per session, suggesting the bug may be in how Claude Code persists hook context rather than
how often hooks fire.
Confirming 2.1.27 regression on low-RAM system
Environment:
Behavior on 2.1.27:
claude --resumetriggered OOM killer on 5-7MB session filesOut of memory: Killed process (claude) total-vm:79GBFix:
This confirms the regression is version-specific, not just session size or RAM amount.
Can't run it via terminal on MacOS anymore, the VSCode extension still works
Confirmed this works on
v2.1.27xMacOS Sequoia 15.7✅ Confirmed working on Claude Code 2.1.27 and macOS Tahoe 26.2 (25C56).
To be safe, I quarantined the matching files instead of deleting them:
Cleared <user>//
projectsfiles (jsonl) - there were over 1.2GB worth of files which were slowing it down. Once done, I asked Claude itself to clear the rest.<img width="1046" height="587" alt="Image" src="https://github.com/user-attachments/assets/d96d99d2-8942-414d-b20d-d627475a5bd1" />
Worked for me as well, thank you!
To work uninterrupted I made a wrapper shell script (around claude) that moves problematic
jsonl to backup dir (maybe I can restore later).
Works well because:
affects new instances
one wrapped claude deletes (or moves in this case) the log of another.
Apologies if already mentioned here TLDR.
(Note: The following is entirely prepared by Claude Code, and my role is nothing more than reproducing the symptoms and directing Claude Code as a non-technical guy. Please take everything with an extra grain of salt.)
(Note 2: Using random UUID seems prevent 100% CPU usage or hanging AFTER you clean or remove those messy JSONL files, whereas putting the two little circuit breakers might help you keep going even with those problematic JSONL files residing in
.claudefolder, but don't ask me anything about the unexpected consequences - chats shouldn't be that messy in the first place.)___
Suspect:
saved_hook_contextUUID reuse → circularparentUuid→ infinite loop inft()Building on @Profreshor's finding regarding
saved_hook_context. All references to minifiedcli.jsin@anthropic-ai/claude-code@2.1.27.What changed in 2.1.27
insertMessageChain(cli.js:5198) gained a new branch that persists hook context to the session JSONL:The attachment is created once at
SessionStartwith a fixed UUID. Each subsequent hook invocation (UserPromptSubmit,PostToolUse,Stop) passes the same object through, writing the same UUID with a differentparentUuideach time. In 2.1.25, this attachment was ephemeral — never written to JSONL.How the cycle forms (example)
Say the hook attachment has UUID
aaa. After a few hook invocations, the JSONL contains:ft()(cli.js:5212) builds aMapkeyed by UUID — last write wins. After processing:Two-node cycle:
aaa → ccc → aaa → ccc → ...Why it hangs
There are two
parentUuid-walking loops without cycle detection that both hit the same cycle.Loop 1 —
ft()leaf finder (cli.js:5212, offset ~3866):Loop 2 —
UW1()chain builder (cli.js:5211, offset ~1034):UW1is called from 6 different locations includingCeY()(conversation chain builder) andpL()(session hydration), making it a wider attack surface.Both are triggered on startup for every JSONL file in the project directory via:
One corrupted file blocks all operations: new chat,
/resume, session listing.CPU profiling evidence: Attaching Node.js inspector (
kill -USR1) to a hung process and capturing a 2-second CPU profile showed 1540/1540 samples (100%) inCeY→UW1. ADebugger.pauseon a second hung process landed inft()at the leaf-finder loop. Both loops confirmed spinning independently.Suggested fixes
1. Generate fresh UUID per write (prevents the bug):
2. Cycle detection in both loops (defense in depth):
3. Non-destructive repair script (preserves session history, unlike deleting the files):
For those bumping into the same issue, run
claude install --force 2.1.25until it's readyclaude install --force 2.1.25If you start Claude immediately afterwards, it's fine. Close it once and then restart Claude -> Claude code is back to the latest build 2.1.27.
Is there a way to keep the version at 2.1.25?
This should work
I had to downgrade to version 2.1.26 for this issue. I performed multiple tests, including disabling all hooks and individual hook groups, but nothing worked.
The only solution that allowed Claude to launch without maxing out 100% CPU at the very first command on version 2.1.27 was to clear the ~/.claude/projects/* folder. This allowed me a full conversation thread (single session).
[ As this is not a long term solution, I have downgraded to 2.1.26].
I believe the history, task logging, and transcription processing are causing the problems. It’s about time we had a clear debug log mode that would help us avoid wasting time on this.
I was experiencing the issue with 2.1.27, conistently freezing on first prompt and pushing CPU usage to 100% for the process. I'm not sure whether it's helpful RE finding the root cause, but anecdotally clearing Claude's cache with
rm -rf ~/.claude/cacheresolved the issue for me (without downgrading)I had Gemini investigate and this is what it came up with:
The actual issue identified was a race condition in the
claudebinary's execution flow,specifically in how it spawns a secondary process for MCP (Model Context Protocol)
support.
Here is the breakdown:
a second instance of itself with the flag --claude-in-chrome-mcp.
state where both were consuming 100% CPU waiting on each other or competing for the
same resource (file scanners in the deployment-log-checker skill), without making
progress.
prevent this collision when the file system or skill state causes a delay.
We resolved this by:
Wrapping the binary with a script (claude_shim.sh) that implements an external mutex.
This ensures that if an MCP process is already running or being spawned, a second one
cannot start, effectively forcing sequential behavior and preventing the resource
collision.
Confirming this issue on WSL2 Ubuntu with VS Code extension v2.1.27
Same behavior - memory explodes within seconds of starting a chat session.
Environment:
Observed behavior:
The VS Code extension spawns TWO claude processes simultaneously:
--model default --max-thinking-tokens 0--model opus --max-thinking-tokens 31999Memory growth over 15 seconds:
Workaround: Using Claude CLI in terminal instead of VS Code extension - stable at ~300MB.
Hi all, Claude Code oncall is aware of the issue. We have identified the cause, related to the new
saved_hook_contextmessage type in transcript files, and will publish a new release imminently.Same problem starting .27 freezing on mac
are they going to fix this? this went from the best coding agent to the worst in a day. frustrating.. hope they push .28 with a fix soon
My Claude Code seems to have updated itself to 2.1.29, no freezing so far
Version 2.1.29 is now out with a fix for this issue. To update, run
claude update.We apologize for the CPU loop and the disruption it caused. This was introduced by corrupted
saved_hook_contextlog entries in 2.1.27.We're adding safeguards to our codebase and feature rollout to avoid similar issues going forward.
I can't seem to find this on the releases page: https://github.com/anthropics/claude-code/releases
Not sure what I'm missing.
BTW @Profreshor, I think Claude gets compiled down to a binary that is basically Bun (different JS runtime). So I don't think Node.js could be the issue ever (so that you won't waste time next time when doing debugging)
@CVirus it should be updated now!
@dicksontsai the https://status.claude.com/incidents/rl6pphjrc2r4 page lists version
2.0.27as affected, and points to this github issue.Can you make sure the status page provides the correct incident information?
<img width="1195" height="727" alt="Image" src="https://github.com/user-attachments/assets/7711af03-2e29-4ae4-b5c1-bef9f3a5e064" />
Still happening to me.
<img width="215" height="66" alt="Image" src="https://github.com/user-attachments/assets/0795aec6-16fd-4d5d-a24e-bcdd283f449e" />
@husniadil I can confirm.
Environment:
Description:
CPU usage progressively increases during a session until reaching 100%. The issue appears to be accumulative - it starts normal but gets worse the longer I work. This happens even before the first compaction occurs.
Steps to Reproduce:
Expected Behavior:
CPU usage should remain stable throughout the session, not accumulate over time.
Actual Behavior:
Additional Context:
This was also reported in earlier versions. The issue persists in 2.1.29. It feels like a memory leak or resource accumulation problem rather than a spike from specific operations.
They nerfed this release so bad. I'm having the same issues (failures on >1 active session and excess resource consumption). Hopefully they fix soon, this is ugly.
+1 for 2.1.29 also having the same bug. Reverting to 2.1.25 with npm install -g @anthropic-ai/claude-code@2.1.25 solves it for now but 2.1.27 and 2.1.29 are very broken. A single prompt, and it hangs with 12 GB of RAM consumed.
Oof, thanks okay. Alright, sounds like we will have to skip this update too. Hopefully someone can confirm that it doesn't freeze for them on the next patch update
also having the same bug, I removed Claude Code and reinstall (native, Mac) [Claude Code is up to date (2.1.29)] still - not working, Claude become not responsive very fast.
Same Issue. Using Macbook Air M4 2025.
<img width="723" height="76" alt="Image" src="https://github.com/user-attachments/assets/d8563c0f-ca71-42cd-ae78-17ae3bf0f894" />
Issue still persists on 2.1.29. I removed the
~/.claudefolder (create a backup first). Which seems to resolve this issue for me.Claude is unusable for me and has been for a while now. 29 does not appear to fix this. the memory issue is not as big of a problem, but there is serious latency on entering anything, and high CPU usage. even in simple sessions it shows this when resuming: (+50 other sessions) - not sure why this would be the case. it was a simple 5 minute claude session.
<img width="221" height="113" alt="Image" src="https://github.com/user-attachments/assets/7799267e-cacd-4a46-900f-6109100ec195" />
2.1.29 is not fixed, seeing 100% CPU usage, please reopen this issue
Entering a single prompt immediately consumes 100% CPU and never progresses on 2.1.29.
This fixed it for me.
See how many of your projects are large (>50 M):
Nuke them if you don't need them:
In case this helps others. I was getting 100 CPU usage and nothing was happening when I ran
claudein terminal.My version was
2.1.27After upgrading to
2.1.29it works now.npm update -g @anthropic-ai/claude-codeUsing 3 CPU now.
Still not fixed for me:
<img width="327" height="60" alt="Image" src="https://github.com/user-attachments/assets/8eef836f-bbd9-4c97-bffb-5074b808d022" />
<img width="355" height="59" alt="Image" src="https://github.com/user-attachments/assets/e1df404a-93d2-495a-821e-c4371c969f98" />
I ran the brand new
/debug, and this is what I received before it froze.I opened that txt file, and here is the snippet:
Edit:
I disabled all of LSP server plugins, and the issue still persists.
Edit:
Ended up renaming the ~/.claude/projects to another name to start fresh. The workaround mentioned by people here is working! Thanks.
Edit:
After some conversations, it stuck again (on 2.1.31). Reverting back to 2.1.25.
I installed 2.1.31 with the same tactics and it's still doing the massive hang + 12 GB. The only command I ran was /debug, ironically.
In case it helps anyone else:
I'm on 2.1.31. Today Claude Code maxed the CPU (Mac M3 - native install) every time I tried to run it - regardless of what project/location I was in.
Found a JSONL file in one of the projects under .claude/projects that was 3GB - and most of it was garbage.
Some part of Claude's process had gone crazy, and I had repeating, duplicate
file-history-snapshotandqueue-operationentries - to the tune of ~30 entries per second for 11 hours straightOnce I truncated the file, the issue disappeared (unsurprisingly!)
This is no longer issue for me, so I believe it's fixed, at least for me.
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.