[BUG] RangeError: Invalid array length causes session crash
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Session crashes with RangeError: Invalid array length when executing certain commands (e.g., /sc:troubleshoot).
The error originates from the Dd6 function in cli.js:
function Dd6(A){if(A<=0)return[];return Array(A).fill(1/A)}
This function appears to be related to experiment arm allocation. The error occurs when A is negative, NaN, Infinity, or not a valid integer.
What Should Happen?
Session should continue without crashing. Experiment arm allocation should handle invalid inputs gracefully with proper error handling and logging, not crash the entire session.
Error Messages/Logs
RangeError: Invalid array length
at Array.fill (anonymous?)
at u3A (file:///Users/juny/.nvm/versions/node/v24.11.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:316:9080)
at u(A (file:///Users/juny/.nvm/versions/node/v24.11.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:318:1008)
at fdA.onRender (file:///Users/juny/.nvm/versions/node/v24.11.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:337:9370)
at fdA.renderer (file:///Users/juny/.nvm/versions/node/v24.11.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:389:5325)
at FJA (file:///Users/juny/.nvm/versions/node/v24.11.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:213:87726)
at JXA (file:///Users/juny/.nvm/versions/node/v24.11.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:213:81621)
at Le (file:///Users/juny/.nvm/versions/node/v24.11.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:213:81802)
at Mg (file:///Users/juny/.nvm/versions/node/v24.11.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:213:81959)
at Immediate.cja (file:///Users/juny/.nvm/versions/node/v24.11.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:206:3463)
Steps to Reproduce
- Start Claude Code CLI session
- Execute /sc:troubleshoot command with any error message
- Session crashes immediately with RangeError
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.0.68 (uncertain - need to verify)
Claude Code Version
2.0.69 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
- Node.js Version: v24.11.1
- npm Version: 11.6.2
- OS Details: macOS Darwin 25.1.0 (ARM64)
- This error has occurred multiple times during normal usage
- The crash is unrecoverable and requires session restart
- Error appears to be related to A/B testing or experiment allocation logic
- Impact: High severity (session crash, data loss)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗