[BUG] RangeError: Invalid string length causes application crash
Resolved 💬 8 comments Opened Jul 16, 2025 by h4cknode Closed Jan 9, 2026
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other:
- Claude CLI version: 1.0.53 (Claude Code)
- Operating System: macOS 26.0 (25A5279m) - Beta/Developer Preview
- Terminal: iTerm.app
Bug Description
Claude Code CLI crashes with a RangeError: Invalid string length when processing data through a Socket connection. The error occurs at line 643 in cli.js during socket data handling.
Steps to Reproduce
- Install Claude Code globally:
npm install -g @anthropic-ai/claude-code - Run Claude Code CLI:
claude - Use Claude Code for extended period or process large amounts of data
- Error occurs and application crashes
Note: Exact reproduction steps are difficult to determine as the error appears to be related to data accumulation over time
Expected Behavior
Claude Code should continue running without crashing when handling data streams.
Actual Behavior
Application crashes with the following error:
RangeError: Invalid string length
at Socket.<anonymous> (file:///Users/ordis/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:643:8967)
at Socket.emit (node:events:519:35)
at Socket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)
Node.js v23.11.0
Additional Context
- Node.js Version: v23.11.0
- NPM Version: 11.4.1
- Installation Path:
/Users/ordis/.npm-global/lib/node_modules/@anthropic-ai/claude-code/ - System Uptime: 1 day, 7 hours, 31 minutes (at time of error)
Environment Notes
Running on beta/preview versions:
- macOS 26.0 (Developer Preview - Build 25A5279m)
- Node.js v23.11.0 (latest release)
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗