[BUG] Bash tool produces no output on Windows - commands run but output files remain empty
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 executes commands successfully on Windows, but produces no output. Output files are created but remain completely empty (0 bytes). Commands are spawned and show "running" status in the background, but never complete or return any output to the user.
This occurs in both Git Bash (MINGW64) and PowerShell on Windows 10. Running the same commands directly in the terminal works perfectly - the issue is specific to the Claude Code Bash tool.
What Should Happen?
Commands executed via the Bash tool should:
- Execute and complete successfully
- Write output to the designated output file
- Return the output to the user
- Show "completed" status
Error Messages/Logs
No explicit error messages are shown. The behavior is:
Command running in background with ID: ba4b5be. Output is being written to:
C:\Users\w\AppData\Local\Temp\claude\C--Users-w\tasks\ba4b5be.output
But the output file remains empty. When checking the task status:
<status>running</status>
Eventually times out or gets killed.
Steps to Reproduce
- Open Claude Code on Windows (tested in both Git Bash MINGW64 and PowerShell)
- Run any simple command via the Bash tool, for example: echo "Hello World"
- Observe that the command shows as "running" in background
- Wait for timeout or check the output file at C:\Users\w\AppData\Local\Temp\claude\C--Users-w\tasks\[task-id].output
- File exists but is 0 bytes (empty)
To verify this is a Claude Code issue and not a shell issue:
- Run the same command (echo "Hello World") directly in your terminal
- It works perfectly and produces output
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.25
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
Terminal works fine: Running commands directly in PowerShell/Git Bash terminal produces normal output. Only the Claude Code
Bash tool is affected.
Output file location pattern:
C:\Users\w\AppData\Local\Temp\claude\C--Users-w\tasks\[task-id].output
Example investigation:
$ ls -la "C:\Users\w\AppData\Local\Temp\claude\C--Users-w\tasks"
-rw-r--r-- 1 w 197121 0 Jan 30 12:00 ba4b5be.output
-rw-r--r-- 1 w 197121 0 Jan 30 12:01 b642c7a.output
Files are created but are 0 bytes.
Initial error encountered (now resolved):
Error: Command failed: cygpath -u 'C:\Users\w\AppData\Local\Temp'
/usr/bin/bash: line 1: cygpath: command not found
After fixing the cygpath issue, commands now run but output is still not captured.
This appears to be a Windows-specific issue with how the Bash tool captures or redirects output from spawned shell processes.
<img width="1586" height="984" alt="Image" src="https://github.com/user-attachments/assets/303c4663-999d-434e-acd6-1145b9e8fa72" />
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗