Bash tool stdout pipe broken on Windows - commands execute but output not captured (v2.1.45)
Resolved 💬 3 comments Opened Feb 18, 2026 by vincitamore Closed Feb 22, 2026
Description
On Windows 11 (Git Bash), the Bash tool's stdout/stderr capture pipe is broken. Commands execute correctly internally but Claude Code receives no output and falsely reports exit code 1.
Environment
- Claude Code version: 2.1.45
- OS: Windows 11 Pro 10.0.26100
- Shell: Git Bash (git version 2.44.0.windows.1)
- Bash path: /usr/bin/bash (MSYS2/MinGW64)
Reproduction
Every Bash tool call returns exit code 1 with zero stdout/stderr:
Bash("echo hello") → Exit code 1, no output
Bash("pwd") → Exit code 1, no output
Bash("whoami") → Exit code 1, no output
Proof that commands execute correctly
Redirecting output to a temp file and reading it back confirms the shell works:
Bash("echo 'bash is alive' > /tmp/test.txt 2>&1 || true") → exit 0
Read("/tmp/test.txt") → "bash is alive"
Bash("echo \$? > /tmp/exit.txt || true") → exit 0
Read("/tmp/exit.txt") → "0" (commands actually succeed)
Bash("git status --porcelain > /tmp/gs.txt 2>&1 || true") → exit 0
Read("/tmp/gs.txt") → correct git status output
Key findings
- Shell subprocess IS running — commands execute, files are written, git works
- stdout/stderr pipe to Claude Code is broken — output never reaches the tool result handler
- Exit code 1 is artificial — actual command exit codes are 0
|| trueforces exit 0 but output still not captured- Persists across session restarts — not a one-time session corruption
- Not a permissions issue — fails with
dangerouslyDisableSandbox: true - No shell profile interference — no
.bashrc/.bash_profile,/etc/profileis stock MSYS2 - Sandbox is not the cause — same behavior with sandbox disabled
Workaround
Redirect output to temp file and read it back:
Bash("command > /tmp/out.txt 2>&1 || true")
Read("/tmp/out.txt")
Impact
All Bash tool functionality is effectively broken — git operations, build commands, process management, etc. all appear to fail despite actually succeeding. The Read/Write/Edit/Grep/Glob tools still work, as do MCP tools.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗