[BUG] Windows usernames with space cause word-splitting in Claude bash wrapper script due to a lack of quoting
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?
Bash tool word-splits paths containing spaces (e.g. Windows usernames with spaces)
Summary
On Windows, when the user profile path contains a space (e.g. C:\Users\Jeff Stewart), every Bash tool invocation emits a spurious error:
/usr/bin/bash: line 1: /c/Users/Jeff: Permission denied
The commands themselves execute correctly, but the error pollutes every tool result and causes a non-zero exit code even when the command succeeds.
Environment
- OS: Windows 11 Home 10.0.26200
- Shell: Git Bash (MSYS2),
/usr/bin/bash - User profile path:
C:\Users\Jeff Stewart(contains a space) - Claude Code version: latest as of 2026-02-22
- 8.3 short names: Disabled on the volume (no short-name workaround available)
Root cause
Running set -x before a command reveals the issue. After the user's command completes, the shell harness executes something like:
pwd -P Stewart/AppData/Local/Temp/claude-XXXX-cwd
This is the second half of a word-split path. The full path is:
/c/Users/Jeff Stewart/AppData/Local/Temp/claude-XXXX-cwd
It appears the harness constructs or references a temp file path derived from the user's HOME or TEMP directory without quoting. The shell splits on the space in "Jeff Stewart", so:
/c/Users/Jeffis consumed by whatever command precedes it (likelycdor a redirect)Stewart/AppData/Local/Temp/claude-XXXX-cwdis interpreted as a command to execute, producing "Permission denied"
Reproduction
- Have a Windows user account with a space in the username
- Run any Bash tool command (even
echo hello) - Observe the spurious error in the output and non-zero exit code
Expected behavior
The cwd-tracking temp file path should be properly quoted so that spaces in the user profile path don't cause word-splitting.
Workarounds attempted
- 8.3 short filenames: Disabled on the volume;
ShortPathreturns the long path unchanged - Overriding HOME/TEMP: The error originates in the harness before user commands run, so environment variable overrides in
.bashrcdon't help - Creating
.bash_profile: No user profile scripts exist; the issue is in the tool's own shell wrapper, not in profile sourcing
Impact
Cosmetic but noisy — every single Bash tool invocation shows the error. The non-zero exit code can also be misleading when checking whether a command actually failed.
What Should Happen?
Windows usernames with spaces should be able to use Claude Code, including tool invocations via the bash wrapper, without any path splitting due to lack of quoting in the claude-owned bash wrapper script.
Error Messages/Logs
Error: Exit code 1
C:\Users\Jeff Stewart
/usr/bin/bash: line 1: /c/Users/Jeff: Permission denied
C:\Users\Jeff Stewart
/usr/bin/bash: line 1: /c/Users/Jeff: Permission denied
Steps to Reproduce
- Create a windows username with spaces in the name
- Run claude code as that user
- run any command that invokes bash (all my subversion add-files, commit, etc. trigger this)
- Observe the error message.
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
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗