[BUG] RangeError: Invalid string length

Resolved 💬 9 comments Opened Apr 27, 2025 by channingwalton Closed May 1, 2025

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 0.2.86
  • Operating System: macOS Version 15.4.1
  • Terminal: Ghostty 1.1.3

Bug Description

Whilst claude is processing a request, I often get a dozens of:

RangeError: Invalid string length
    at Socket.<anonymous> (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:501:26748)
    at Socket.emit (node:events:507:28)
    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)

Steps to Reproduce

  1. Give claude code something to do
  2. Wait whilst it thinks
  3. sometimes it blows up with the above error

Expected Behavior

No error

Actual Behavior

The error above

Additional Context

It doesn't seem to matter what I ask claude to do.

View original on GitHub ↗

This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗