[BUG] Claude Code hangs entirely when /dev/stdin is read using Bash tool in a sandbox

Resolved 💬 11 comments Opened Jan 5, 2026 by archer-eric Closed Feb 13, 2026

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?

_[Created with Claude Code using Claude Opus 4.5]_

Summary

When the Bash tool reads from /dev/stdin (or equivalents /dev/fd/0, /proc/self/fd/0) in sandbox mode, Claude Code hangs after the command completes. The command produces correct output, but Claude Code becomes unresponsive afterward (spinner stops, input blocked).

Hang occurs when:

  • /dev/stdin is read as a file argument (e.g., cat /dev/stdin)
  • /dev/stdin is used as a redirect with an external command as pipe source (e.g., seq 2 | cat < /dev/stdin)

Does NOT hang when:

  • /dev/stdin is used as a redirect with a builtin as pipe source (e.g., echo 1 | cat < /dev/stdin)
  • stdin is read normally without referencing /dev/stdin (e.g., cat or timeout 1 cat)

By "hang", I mean:

  • nothing on the display changes (not even the spinner)
  • keys do not add text to the prompt
  • <Esc> does not have any effect
  • Ctrl-C does not have any effect
  • The Terminal in which Claude Code was run must be closed

Environment

  • Claude Code 2.0.76
  • Ubuntu 24.04.3 LTS
  • Linux 6.14.0-36-generic
  • Bash 5.2.21
  • Minimal Claude Code config with sandbox enabled:
{
  "sandbox": {
    "enabled": true
  }
}

Steps to Reproduce

Warning: This may hang Claude Code:

claude 'Run in sandbox: cat /dev/stdin'

Behavior Pattern

Hangs

cat /dev/stdin                      # file argument, no input
cat /dev/stdin <<< "test"           # file argument, with input
cat /dev/fd/0                       # /dev/fd/0 equivalent
cat /proc/self/fd/0                 # /proc/self/fd/0 equivalent
/bin/echo 1 | cat < /dev/stdin      # redirect, external source

Does NOT hang

echo 1 | cat < /dev/stdin           # redirect, builtin source
cat /dev/stdin <&- 2>/dev/null      # stdin closed before read

Errors (no hang)

cat < /dev/stdin <<< "test"         # ENXIO: No such device or address

What Should Happen?

maybe don't hang

Error Messages/Logs

Steps to Reproduce

see report above

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.76 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

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