[BUG] Claude Code Freezes on Continuous/Streaming Output (Serial Ports, Long-Running Processes)

Resolved 💬 5 comments Opened Nov 17, 2025 by jairo-caro-ag Closed Nov 21, 2025

[BUG] Claude Code Freezes on Continuous/Streaming Output (Serial Ports, Long-Running Processes)

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?

Claude Code immediately freezes when rendering continuous/unbuffered stream output, specifically from:

  • Serial ports (cat /dev/tty.usbmodem*)
  • Long-running processes with continuous output
  • Any unbuffered stream without discrete termination

Steps to Reproduce

Minimal reproduction:

  1. Start fresh Claude Code session
  2. Run: cat /dev/tty.usbmodem21401 (or any serial port)
  3. Immediate freeze - terminal completely unresponsive
  4. Must force-kill Claude Code

Test script provided:

# Clone the repo and run:
cd ~/claude-code
./test_stream_freeze.sh continuous  # Will freeze immediately

See test_stream_freeze.sh and FREEZE_BUG_REPRODUCTION.md in the repo for full test suite and analysis.

What Should Happen?

Expected behavior:

  • Stream output should render in real-time
  • Should have timeout mechanism (e.g., 5 seconds)
  • Should not deadlock on unbuffered streams
  • Should remain responsive even with continuous output

Actual behavior:

  • Complete freeze after starting stream
  • No timeout mechanism
  • Terminal becomes unresponsive
  • Must force-kill Claude Code process

Confirmed Facts

Happens in fresh sessions (not memory accumulation)
Immediate freeze (< 1 second after starting stream)
Reproducible with serial ports
Workaround exists: Redirect to file first (timeout 5 cat /dev/tty.* > file && cat file)

Root Cause Analysis

Hypothesis:

  1. Claude Code's stream parser tries to buffer continuous output
  2. Parser waits for stream termination or line boundaries
  3. With continuous streams, neither occurs
  4. Parser/renderer enters deadlock waiting for completion
  5. UI thread becomes unresponsive

Why file redirection works:

timeout 5 cat /dev/tty.usbmodem* > /tmp/out.txt
cat /tmp/out.txt  # Works - discrete, bounded output

File redirection provides discrete, complete output rather than continuous stream.

Claude Model

Sonnet (default)

Is this a regression?

Unknown - may have existed since serial port support was added

Last Working Version

_N/A - appears to have never worked for continuous streams_

Claude Code Version

1.0.113 (VSCode Extension)

Platform

Anthropic API

Operating System

macOS (Darwin 25.1.0)

Terminal/Shell

zsh + VS Code integrated terminal

View original on GitHub ↗

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