Bash tool fails with EINVAL on WSL commands in Windows 11
Resolved 💬 3 comments Opened Feb 27, 2026 by TheusFire Closed Feb 27, 2026
Environment
- OS: Windows 11
- Claude Code version: Latest (as of 2026-02-27)
- Shell: WSL2 (Ubuntu)
Description
Bash tool intermittently fails with EINVAL: invalid argument when attempting to execute WSL commands. The error occurs before the command runs — Claude Code fails to write output to its temp file.
Error
EINVAL: invalid argument, open 'C:\Users\User\AppData\Local\Temp\claude\...'
Behavior
- Some bash calls succeed in the same session
- Others fail with the above error
- Appears specific to certain WSL command structures
- Not a WSL problem — the command never executes; the failure is in Claude Code's temp file handling
Reproduction
Intermittent. Occurs during normal WSL bash usage on Windows 11. Have not isolated a specific trigger but it seems more likely with certain WSL commands than others.
Possible Causes
- Windows temp path handling issue
- Claude Code bug specific to Win11 + WSL2
- Something about the WSL command structure triggering the temp file write failure
Happy to provide more details if needed.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗