Claude Code crashes debugging a program with an infinite loop

Resolved 💬 3 comments Opened Sep 14, 2025 by erixoltan Closed Sep 18, 2025

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?

Bug Summary: Claude Code crashes with "RangeError: Invalid string length" when handling extremely large output (27M+
lines) from a subprocess that runs into an infinite loop.

Key Details:

  • Error occurs at cli.js:780 when processing stdout data
  • Triggered by python phi3_conversation.py producing massive output due to infinite input loop
  • Node.js v20.19.4 on Linux
  • Claude Code should handle large outputs gracefully instead of crashing

The crash happens because the subprocess generated millions of lines of output, exceeding Node.js string length
limits when Claude Code tried to buffer it all.

What Should Happen?

Claude Code should not crash, it should handle the condition more gracefully.

Error Messages/Logs

Steps to Reproduce

  1. Create a program that will enter an infinite loop that causes it to keep printing output. It should be subtle enough that Claude isn't able to fix the problem without actually running the program.
  2. Ask claude code to help debug it. The program will enter an infinite loop, print a huge amount of output and crash Claude Code.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

v1.0.62

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

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