TypeError: A.with is not a function — regression in 2.1.78 on Node.js 18
Bug Report: TypeError regression in Claude Code 2.1.78
Summary
Claude Code 2.1.78 introduced a TypeError: A.with is not a function that kills sessions mid-execution. Not present in 2.1.74-2.1.77. Discovered while running Terminal-Bench (89 coding tasks) on Modal containers.
Reproduction
Any Claude Code 2.1.78 session running in a containerized environment (Modal, Daytona) with Node.js 18.x. The error fires during result serialization after the agent has been working — tasks complete their logic but the session crashes before clean exit.
TypeError: A.with is not a function
at l5z (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:6892:266)
at p5z (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:6887:12301)
at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:6887:12002
at Array.reduce (<anonymous>)
at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:6887:11988
at Array.forEach (<anonymous>)
at UD (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:6887:10654)
at pZq (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:6612:9819)
at async file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:6612:6557
at async Sf8 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:944:2408)
Evidence
We run the same 89-task benchmark across versions. The only variable between runs is the Claude Code version installed via npm install -g @anthropic-ai/claude-code@<version>:
| Claude Code | Run | Tasks | Pass Rate | TypeErrors | Errors |
|------------|-----|-------|-----------|------------|--------|
| 2.1.74 | v10b | 18 | 78% | 0 | 0 |
| 2.1.75 | v12 | 18 | 56% | 0 | 0 |
| 2.1.75 | v13 | 18 | 44% | 0 | 0 |
| 2.1.77 | v14 | 21 | 38% | 0 | 0 |
| 2.1.78 | v15 | 17 | 41% | 5 (29%) | 0 |
| 2.1.74 (pinned) | v16 | 5* | 80% | 0 | 0 |
*v16 still running at time of writing
Likely Root Cause
Array.prototype.with() is an ES2023 method requiring Node.js 20+. The minified symbol A.with in the stack trace suggests new code in 2.1.78 uses Array.with() in a result serialization path (l5z → p5z → UD → pZq). Modal/Daytona containers ship Node.js 18.x by default.
The error only fires after task execution — the agent reads files, writes code, runs tests — then Claude Code crashes during output processing. This means:
- Tasks that complete before the crash can still pass verification
- Tasks interrupted mid-stream get
error_during_executionwith 0 useful output - The crash is non-deterministic in timing but consistent in occurrence
Environment
- Install method:
npm install -g @anthropic-ai/claude-code@latest - Container OS: Ubuntu (Modal sandboxes)
- Node.js: 18.x (installed via
apt-get install nodejs) - Invocation:
claude -p "..." --output-format stream-json --dangerously-skip-permissions - Auth: OAuth token via
CLAUDE_CODE_OAUTH_TOKENenv var
Workaround
Pin to 2.1.77 or earlier:
npm install -g @anthropic-ai/claude-code@2.1.77
Impact
This blocks any CI/container pipeline using @latest on Node.js 18 environments. The error is silent (exit code 0) and only visible in stream-json output, making it hard to diagnose without log inspection.
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗