claude-code - 💡(How to fix) Fix statusLine custom command deadlocks due to unclosed stdin pipe / missing EOF in v2.1.143

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

No explicit error message is thrown in the terminal, but the status line remains entirely blank. Manual testing of the stream pipe confirms it hangs indefinitely waiting for EOF.

Root Cause

Deep debugging reveals that any attempt to read from stdin within the external process (such as [Console]::In.ReadToEnd(), ReadLine(), or even async Wait() mechanisms) blocks indefinitely. This happens because Claude Code pushes the JSON payload into the pipe but keeps the pipe open without signaling EOF or appending a trailing newline (\n).

Fix Action

Fix / Workaround

We attempted to implement an async workaround with a timeout wrapper in .NET Framework 4.x (e.g., $task.Wait(200)), but it still resulted in no output. This indicates that Claude Code's process lifecycle management for statusLine execution is highly aggressive (likely well below 200ms), meaning any amount of blocking on stdin will cause the script to be killed immediately.

Code Example

No explicit error message is thrown in the terminal, but the status line remains entirely blank. Manual testing of the stream pipe confirms it hangs indefinitely waiting for EOF.

---

"statusLine": {
  "type": "command",
  "command": "powershell -NoProfile -File C:\\path\\to\\statusline-script.ps1"
}

---

$inputJson = [Console]::In.ReadToEnd() 
# Or $inputJson = [Console]::In.ReadLine()
# The script hangs here indefinitely because no EOF or newline is received.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When configuring a custom script for statusLine via settings.json (e.g., running a PowerShell script), the status line completely disappears or fails to display any output.

Deep debugging reveals that any attempt to read from stdin within the external process (such as [Console]::In.ReadToEnd(), ReadLine(), or even async Wait() mechanisms) blocks indefinitely. This happens because Claude Code pushes the JSON payload into the pipe but keeps the pipe open without signaling EOF or appending a trailing newline (\n).

Because Claude Code has a very tight internal timeout for the status line execution, the blocked script process is killed before it can return any stdout, resulting in a blank status line.

Notably, this issue began occurring mid-session today between 3:03 PM and 3:35 PM without a binary update, strongly suggesting that a server-side feature flag or a specific runtime state (potentially related to token tracking) altered Claude Code's pipe-handling behavior.

What Should Happen?

Claude Code should explicitly close the stdin pipe (signal EOF) or at least append a proper newline character after writing the statusLine JSON payload. This will allow external scripts to finish reading the stream and output the status line successfully without deadlocking.

Error Messages/Logs

No explicit error message is thrown in the terminal, but the status line remains entirely blank. Manual testing of the stream pipe confirms it hangs indefinitely waiting for EOF.

Steps to Reproduce

  1. Configure a custom command in ~/.claude/settings.json:
"statusLine": {
  "type": "command",
  "command": "powershell -NoProfile -File C:\\path\\to\\statusline-script.ps1"
}
  1. In statusline-script.ps1, attempt to read the JSON configuration payload from standard input:
$inputJson = [Console]::In.ReadToEnd() 
# Or $inputJson = [Console]::In.ReadLine()
# The script hangs here indefinitely because no EOF or newline is received.
  1. Launch Claude Code (cc). The status line will be missing/blank because the script process is deadlocked and subsequently terminated by Claude Code's internal timeout.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

The behavior worked properly on v2.1.143 earlier today before a runtime/session state shift triggered the pipe blockage.

Claude Code Version

v2.1.143

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

We attempted to implement an async workaround with a timeout wrapper in .NET Framework 4.x (e.g., $task.Wait(200)), but it still resulted in no output. This indicates that Claude Code's process lifecycle management for statusLine execution is highly aggressive (likely well below 200ms), meaning any amount of blocking on stdin will cause the script to be killed immediately.

Since "autoUpdates": false was set and the binary modification timestamp did not change between when it worked (3:03 PM) and when it broke (3:35 PM), this is a classic runtime session or remote-config triggered edge case.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix statusLine custom command deadlocks due to unclosed stdin pipe / missing EOF in v2.1.143