claude-code - 💡(How to fix) Fix [Bug] Unbounded thread creation causes out-of-memory condition [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45409Fetched 2026-04-09 08:06:05
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×3

Error Message

[{"error":"Error: rg --files exited 2\n at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:539:84)\n at emit (node:events:98:22)\n at #maybeClose (node:child_process:766:16)\n at #handleOnExit (node:child_process:520:72)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-08T20:05:30.447Z"}]

Code Example

[{"error":"Error: rg --files exited 2\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:539:84)\n    at emit (node:events:98:22)\n    at #maybeClose (node:child_process:766:16)\n    at #handleOnExit (node:child_process:520:72)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-08T20:05:30.447Z"}]
RAW_BUFFERClick to expand / collapse

Bug Description there's something that happens that spins up thousands of threads and OOM's my system. this is the only command that saved me until i could find the session that was responsible. i htink it was htis session: for pid in (pgrep -f "bash.*claude") kill -9 $pid end

Environment Info

  • Platform: linux
  • Terminal: ghostty
  • Version: 2.1.96
  • Feedback ID: 7ebfa0f0-a5e5-47f1-bf40-d5529b0a6e74

Errors

[{"error":"Error: rg --files exited 2\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:539:84)\n    at emit (node:events:98:22)\n    at #maybeClose (node:child_process:766:16)\n    at #handleOnExit (node:child_process:520:72)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-08T20:05:30.447Z"}]

extent analysis

TL;DR

The issue can be temporarily mitigated by identifying and killing the problematic process using the provided command, but a more permanent solution requires understanding the root cause of the thread explosion.

Guidance

  • Investigate the claude session and its associated processes to determine why it's spawning thousands of threads, potentially leading to an Out-of-Memory (OOM) error.
  • Use the provided command as a temporary workaround to kill the problematic processes: for pid in (pgrep -f "bash.*claude"); do kill -9 $pid; done.
  • Review the error log to understand the context of the error, specifically the rg --files command that exited with a status code of 2, which might be related to the thread explosion.
  • Consider monitoring system resources and process activity to detect similar issues before they cause an OOM error.

Example

No specific code example is provided as the issue seems to be related to a specific command or session (claude) that is not fully described.

Notes

The provided solution is a temporary workaround, and the actual fix will depend on understanding the root cause of the thread explosion. The error log suggests an issue with the rg --files command, but its relation to the claude session and the thread explosion is not clear.

Recommendation

Apply workaround: The provided command to kill the problematic processes can be used as a temporary solution until the root cause is identified and fixed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING