[BUG] Claude Code crash
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other:
- Claude CLI version: 1.0.24
- Operating System: linux
- Terminal: ghostty
Bug Description
Claude code crashes with:
RangeError: Invalid string length
at Socket.<anonymous> (file:///home/evanphx/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:583:7171)
at Socket.emit (node:events:519:28)
at Socket.emit (node:domain:488: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:191:23)
Steps to Reproduce
- Run any prompt
Expected Behavior
It doesn't crash.
Actual Behavior
It crashes!
Additional Context
Same here. It creted itself an demo app and tried to run it, dotnet code base. The error happens quite rapidly after the demo app starts. Tried to continue the conversation 3 times, every time same error.
Ubuntu 22.04, Claude Code 1.0.31
RangeError: Invalid string length
at Socket.
Node.js v22.16.0
duplicate of https://github.com/anthropics/claude-code/issues/962
In my case the issue is probably the code printing way too much debug/info write to terminal. Potential fix could be to just take a snippet from start and end, maybe middle. Advanced version might allow tools use to search to terminal output. At minimum it should not crash, just print " too much output"