RangeError: String Length Overflow in Claude Code CLI Socket Handler
Bug Description
RangeError: Invalid string length
at Socket.
Environment Info
- Platform: macos
- Terminal: Apple_Terminal
- Version: 1.0.3
- Feedback ID: 4b0d94b1-866c-4228-9099-84dd238f14e8
Errors
[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n at genericNodeError (node:internal/errors:983:15)\n at wrappedFn (node:internal/errors:537:14)\n at checkExecSyncError (node:child_process:882:11)\n at execSync (node:child_process:954:15)\n at cG (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:644:3513)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:574:15313\n at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:532:13335)\n at sR1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:574:14562)\n at aI (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:574:14179)\n at FU2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1965:20997)","timestamp":"2025-05-25T12:30:00.703Z"},{"error":"Error: ENOENT: no such file or directory, scandir '/Users/rozzie/.claude/ide'\n at Module.readdirSync (node:fs:1581:26)\n at Object.readdirSync (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:540:1519)\n at UD0 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1318:16584)\n at Da (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1319:2580)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2370:11384\n at b7 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:150:21374)\n at hZ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:150:40861)\n at wW (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:150:34915)\n at W5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:148:4822)\n at $8 (file:///opt/homebrew/li
Note: Error logs were truncated.
Also seeing this (similar environment to the reporter).
RangeError: Invalid string length
at Socket.<anonymous> (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:574:2996)
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:190:23)
I can also reproduce this when asking Claude to debug anything that prints very long strings as output
Duplicate: https://github.com/anthropics/claude-code/issues/962
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.