RangeError: Maximum call stack size exceeded crash
Bug Description
Claude Code crashes with RangeError: Maximum call stack size exceeded during a session.
Error Output
file:///C:/Users/Cassie/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3437
...
RangeError: Maximum call stack size exceeded
(Use `node --trace-uncaught ...` to show where the exception was thrown)
Node.js v22.12.0
Context
- This occurred during normal usage
- The crash dumps minified JS code to the terminal before the RangeError
- Session becomes unrecoverable
Environment
- OS: Windows 11
- Node.js: v22.12.0
- Claude Code: CLI version (npm install)
🤖 Generated with Claude Code
Additional context: This crash occurred during normal usage without parallel sub-agents running. So this is a separate issue from the parallel agent context management bugs.
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/16797
- https://github.com/anthropics/claude-code/issues/16871
- https://github.com/anthropics/claude-code/issues/16745
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
Exactly the same issue here. When Claude was busy working on a bit larger set of changes, the exception occured:
file:///Users/dawid/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:3437
`,isMeta:!0}),...A]}async function t59(A,Q){if(GrQ())return;let[{tools:B},G,Z,Y]=await Promise.all([pI1(A),rz(
...
K),hookName:`PreToolUse:${Q.name}`,toolUseID:G,hookEvent:"PreToolUse"})}},yield{type:"stop"}}}catch(I){r(I instanceof Error?I:Error(String(I))),yield{type:"stop"};return}}function kF1(A){if(A instanceof lY)return A.message||b_;if(!(A instanceof Error))return String(A);let B=ZM0(A).filter(Boolean).join(`
...
RangeError: Maximum call stack size exceeded
I'm on MacOS, node version v22.15.0. I suspect it may be related to Node v22 - I upgraded from Node v20 yesterday.
I will close my duplicate bug, but dev should note this:
Added: https://github.com/anthropics/claude-code/issues/16949#issuecomment-3725946749
The comment includes:
- Complete minified stack trace from your error
- Key observations about the code paths involved (xF1 tool concurrency class, processQueue(), async iterators)
- Hypothesis about recursive queue processing or async iterator corruption
✶ Insight ───────────────────────────────────── What the stack trace reveals:
- xF1 class manages concurrent tool execution with a queue
- processQueue() is called recursively via Z.finally(() => this.processQueue())
- If two sessions share state and both trigger queue processing, this could create unbounded recursion
- The tengu_context_size telemetry function suggests background polling was active when crash occurred
More context: Was asking Claude to fix a batch file import path issue when the crash occurred. Claude had previously tried to recreate an entire 900+ line file instead of fixing the import (separate issue #16780). This crash happened on a retry of the same task.
This is happening fairly consistently for me since the auto-upgrade to Claude Code 2, to the point that Claude Code is more or less unusable in any session longer than 15 minutes or so.
It seems to happen when idle mostly for me.
It seems to happen when idle mostly for me.
Same here, happened while the CLI and agent was supposedly completely idle in a background tab.
Same here, also, my usage limit suddenly blown up to 90% although I barely used Claude code (pro subscription).
I'm also experiencing this whilst CC is idle.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
I'm facing the issue