[BUG] Git Bash commands fail with write error: Bad file descriptor on Windows - stdout broken
Resolved 💬 3 comments Opened Feb 18, 2026 by edora-christiankaaber Closed Feb 18, 2026
Bug Description
All Bash tool commands in Claude Code fail with "write error: Bad file descriptor" on Windows.
Even basic commands like echo hello, pwd, whoami, and printenv fail. The shell is
completely non-functional — no command produces stdout output.
PowerShell commands via powershell.exe -Command '...' work fine from the same session.
Reproduction Steps
- Install Claude Code 2.1.45 on Windows 11 with Git for Windows 2.53.0
- Start Claude Code
- Any Bash tool command fails:
$ echo hello
/usr/bin/bash: line 1: echo: write error: Bad file descriptor
(exit code 1)
$ pwd
(exit code 1, no output)
$ printenv
(exit code 2, no output)
- PowerShell works fine from the same session:
$ powershell.exe -NoProfile -Command 'echo hello'
hello
Impact
- Bash tool is completely broken — no commands return output
- Environment variables set at User level in Windows are invisible to bash
- Users must route everything through
powershell.exeas a workaround
Environment
- Claude Code: 2.1.45
- OS: Windows 11 Home (10.0.26200)
- Architecture: AMD64
- Git: 2.53.0.windows.1
- Bash path: C:\Program Files\Git\usr\bin\bash.exe
- Node: v25.6.1
- npm: 11.9.0
Analysis
The error "write error: Bad file descriptor" indicates that stdout (fd 1) is closed or
invalid when bash tries to write to it. The bash binary and coreutils are intact
(verified via PowerShell). The issue appears to be in how Claude Code sets up the
file descriptors / pipe for the spawned bash process.
Possibly Related Issues
- #15287 (EBADF: bad file descriptor error on Windows)
- #15471 (Windows Shell Compatibility Issue)
- #4507 (Git Bash path with space in Program Files)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗