[BUG] Bash tool broken on Windows when username contains apostrophe
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 fails for every command when the Windows username path contains an apostrophe (e.g., C:\Users\Matt's PC). Every command returns:
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching '
Even simple commands like echo test or ls fail. The apostrophe in the path is being interpreted as an unmatched single quote by bash.
Environment:
Windows 11 Pro 10.0.26200
Claude Code running inside Windsurf (VS Code fork)
Git Bash provides /usr/bin/bash
Username path: C:\Users\Matt's PC
Attempted workarounds (none worked):
Set CLAUDE_CODE_SHELL env variable to powershell.exe (user-level and project-level settings.json)
Set HOME env variable to a path without apostrophe
Project-level .claude/settings.local.json with env overrides
Restarting the IDE multiple times
What Should Happen?
Expected behavior:
Either bash should properly escape paths with special characters, or the CLAUDE_CODE_SHELL setting should work in the Windsurf extension to allow switching to PowerShell.
Impact:
Complete inability to use the Bash tool. All shell commands fail regardless of content.
Error Messages/Logs
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `'`
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `'`
Exit code 2
Steps to Reproduce
Steps to reproduce:
Have a Windows user account with an apostrophe in the name (e.g., Matt's PC)
Install Claude Code in Windsurf (or VS Code)
Open any project
Try to run any Bash tool command — even echo test
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.69 (Claude Code)
Platform
AWS Bedrock
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
Windows username contains an apostrophe: C:\Users\Matt's PC
This causes Git Bash (/usr/bin/bash) to fail on EVERY command with:
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching '
Even echo test fails. The apostrophe in the user profile path is interpreted as an unmatched single quote.
Workarounds attempted (none worked):
- CLAUDE_CODE_SHELL env var set to powershell.exe (user-level + project-level settings.json)
- HOME env var set to path without apostrophe
- 8.3 short path also contains apostrophe (MATT'S~1)
- Multiple restarts of IDE
Claude Code version: Windsurf extension
Model: claude-opus-4-6
OS: Windows 11 Pro 10.0.26200
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗