[BUG] Shell snapshot and cwd temp file errors on every Bash tool call (Windows / MSYS2+Cygwin)
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?
Every Bash tool call produces two spurious errors on stderr, and the entire output (errors + actual command result) is duplicated:
- Shell snapshot:
bash: line 1: /c/Users/<user>/.claude/shell-snapshots/snapshot-bash-<id>.sh: No such file or directory— the file exists on disk with valid content and LF line endings, but bash treats the path as a command to execute rather than a file to source. - CWD temp file:
bash: line 1: /c/Users/<SHORT~1>/AppData/Local/Temp/claude-<hash>-cwd: No such file or directory— uses Windows 8.3 short name; the file either doesn't exist by the time the command runs, or the short path doesn't resolve.
The exit code is always 1 due to the stderr noise, even when the command itself succeeds.
This produces noisy output that is hard to visually track (did this command actually error out or is it the shell snapshot noise again?), and sometimes Claude gets confused too, saying "hm, that errored. no wait, it didn't. oh, it's the shell noise" which is a waste of time, context and tokens.
What Should Happen?
Bash tool calls should execute cleanly without spurious errors on stderr. The shell snapshot should be sourced (. <path> or source <path>), not executed as a command. The CWD temp file should exist and be accessible when the wrapper script references it. Output should not be duplicated.
Error Messages/Logs
$ echo "hello"
/usr/bin/bash: line 1:
/c/Users/MyUserName/.claude/shell-snapshots/snapshot-bash-1771704285950-yledp0.sh: No such file
or directory
hello
/usr/bin/bash: line 1: /c/Users/MYUSER~1/AppData/Local/Temp/claude-39ac-cwd: No such file or
directory
/usr/bin/bash: line 1:
/c/Users/MyUserName/.claude/shell-snapshots/snapshot-bash-1771704285950-yledp0.sh: No such file
or directory
hello
/usr/bin/bash: line 1: /c/Users/MYUSER~1/AppData/Local/Temp/claude-39ac-cwd: No such file or
directory
Note: the snapshot file **does** exist — verified with `ls` and `xxd`. It has LF line endings and valid shell content.
Steps to Reproduce
- Install Claude Code on Windows with MSYS2/Cygwin bash as the default shell
- Open any project (VS Code extension or CLI)
- Run any Bash tool call, e.g.
echo "hello" - Observe: two errors on stderr, duplicated output block, exit code 1
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.50 (Claude Code)
Platform
Other
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
- Windows 10 build 19045
- Shell: GNU bash 5.2.21(1)-release (x86_64-pc-cygwin)
- I run
zshandohmyzshas my shell interpreter - uname:
CYGWIN_NT-10.0-19045 3.5.5-1.x86_64 - Claude Code launched via the VS Code extension
P.S.
This report was generated by Claude Code itself after I asked it to dive deeper into what is causing the issue. I'd be happy to do some manual digging too if necessary.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗