claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

RangeError: Maximum call stack size exceeded crash

Open ThatDragonOverThere opened this issue 10 months ago • 6 comments

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

ThatDragonOverThere avatar Jan 08 '26 15:01 ThatDragonOverThere

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.

ThatDragonOverThere avatar Jan 08 '26 15:01 ThatDragonOverThere

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/16797
  2. https://github.com/anthropics/claude-code/issues/16871
  3. 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

github-actions[bot] avatar Jan 08 '26 15:01 github-actions[bot]

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.

dsibinski avatar Jan 08 '26 19:01 dsibinski

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

rubrical-worker avatar Jan 08 '26 21:01 rubrical-worker

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.

ThatDragonOverThere avatar Jan 08 '26 22:01 ThatDragonOverThere

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.

cscheid avatar Jan 09 '26 01:01 cscheid

It seems to happen when idle mostly for me.

WhatcomSci avatar Jan 09 '26 05:01 WhatcomSci

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.

folknor avatar Jan 09 '26 08:01 folknor

Same here, also, my usage limit suddenly blown up to 90% although I barely used Claude code (pro subscription).

Przemyslaw10 avatar Jan 09 '26 14:01 Przemyslaw10

I'm also experiencing this whilst CC is idle.

herskinduk avatar Jan 09 '26 16:01 herskinduk

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.

github-actions[bot] avatar Feb 09 '26 10:02 github-actions[bot]

I'm facing the issue

Swiffers avatar Feb 18 '26 19:02 Swiffers