[BUG] Bash tool returns Exit code 1 for all stdout-producing commands on Windows (stdout pipe broken)

Resolved 💬 3 comments Opened Feb 18, 2026 by office586 Closed Feb 19, 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?

The Bash tool returns Exit code 1 for virtually all commands on Windows, making it completely unusable. Any command that writes to stdout fails, while commands with no output (like true) succeed.

Examples:

  • echo "test" → Exit code 1, no output
  • whoami → Exit code 1, no output
  • true → Exit 0 ✓ (no output)
  • powershell.exe -Command "echo test" → Works ✓

The bash binary itself works fine when invoked directly outside the tool.

What Should Happen?

The Bash tool should execute shell commands and return their stdout output with exit code 0.

Error Messages/Logs

Tool result: Exit code 1
(no output, no error message shown)

Diagnostic findings:
- `true` → Exit 0, no output (succeeds)
- `echo test` → Exit code 1, no output (fails)
- `ssh -V 2>&1` → Exit 0, no output (stdout not captured)
- bash.exe itself works fine when called via PowerShell:
  `& 'C:\Program Files\Git\usr\bin\bash.exe' -c 'echo test'` → outputs "test"
- `bash --norc --noprofile -c 'echo test'` → works correctly outside the tool
- No .bashrc or .bash_profile exists in user home directory

Steps to Reproduce

  1. Open Claude Code in VS Code on Windows 11
  2. Start a new conversation or continue an existing one
  3. Ask Claude to run any shell command via the Bash tool (e.g., "run echo test" or "check the current directory")
  4. Observe: any Bash command that produces stdout output returns Exit code 1 with no output shown
  5. Examples that fail: echo "test", whoami, pwd, ls, git status
  6. Example that succeeds: true (exits 0, but produces no output anyway)
  7. The tool appears to execute but stdout is completely suppressed and exit code is always 1

This makes all file-producing commands, git operations, SSH commands, etc. completely unusable.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.44

Claude Code Version

2.1.45

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

Key finding: Extension auto-updated to v2.1.45 approximately 14 hours ago.
The Bash tool breakage appears to have started after this update.

Behavior

| Command | Expected | Actual |
|---------|----------|--------|
| echo "test" | Exit 0, output: test | Exit code 1, no output |
| whoami | Exit 0, output: username | Exit code 1, no output |
| true | Exit 0, no output | Exit 0 ✓ |
| ssh -V 2>&1 | Exit 0, SSH version | Exit 0, no output |
| powershell.exe -Command "echo test" | Exit 0, output | Works ✓ |

Key Observations

  • true succeeds (exit 0) — bash itself runs correctly
  • Any command that writes to stdout returns exit code 1
  • bash --norc --noprofile -c 'echo test' works correctly outside the tool
  • No .bashrc or .bash_profile in user home directory
  • dangerouslyDisableSandbox: true does not fix the issue
  • Behavior identical in new sessions, after VS Code reload, Extension Host restart

Root Cause Hypothesis

The Bash tool's stdout pipe appears broken. The bash process runs but its stdout
cannot be read by the Claude Code process. May be a regression in v2.1.45.

Workaround

Writing PowerShell .ps1 files and executing via powershell.exe -ExecutionPolicy Bypass -File script.ps1

Possibly related

Anthropic status page showed "Elevated errors on Claude Sonnet 4.6" simultaneously.
https://status.anthropic.com

View original on GitHub ↗

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