[BUG] -c: line 1: unexpected EOF while looking for matching `''
Status Closed — not planned
Reported on v2.1.47
Maintainer reply None cached
Workaround ✓ Mentioned in description ↑
Activity 15 comments · opened Feb 19, 2026 · closed Apr 23, 2026
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?
Hi,
None of the bash commands are working in the latest version 2.1.47, my user folder on windows contains a ' and this is not being escaped correctly. C:\Users\SeanO'Loughlin
● Bash(cd "S:/project" && dotnet test --no-restore 2>&1 | tail -100)
⎿ Error: Exit code 2
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
What Should Happen?
The bash commands should work.
Error Messages/Logs
● Bash(cd "S:/project" && dotnet test --no-restore 2>&1 | tail -100)
⎿ Error: Exit code 2
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
● Bash(cd S:/project && dotnet test --no-restore 2>&1 | tail -100)
⎿ Error: Exit code 2
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
● Bash(cd /s/project && dotnet test --no-restore 2>&1 | tail -100)
⎿ Error: Exit code 2
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
● Bash(dotnet test S:/project --no-restore 2>&1)
⎿ Error: Exit code 2
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
● The path with the apostrophe in the username is causing issues. Let me work around it.
● Bash(cd /s/project && dotnet test 2>&1)
⎿ Error: Exit code 2
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
● Bash(pushd /s/project && pwd)
⎿ Error: Exit code 2
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
● Bash(pwd)
⎿ Error: Exit code 2
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
● Bash(echo hello)
⎿ Error: Exit code 2
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
● Bash(echo "hello world")
⎿ Error: Exit code 2
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
Steps to Reproduce
Have a ' in your users folder name on Windows.
Install version 2.1.47 and ask claude to ls
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.45
Claude Code Version
2.1.47
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
15 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
any movement on this?
Same issue here. Windows username contains an apostrophe (Irish surname) — identical unexpected EOF while looking for matching ' on every Bash tool call.
Environment:
Windows 11 Pro, Claude Code VSCode extension (latest)
Git Bash installed at C:\Program Files\Git\bin\bash.exe
Key finding — system bash works fine:
C:\> where bash
C:\Program Files\Git\bin\bash.exe
C:\> bash -c "echo hello"
hello
Claude Code ignores system PATH and uses /usr/bin/bash (WSL) regardless.
What I've tried (none worked):
Renamed WSL bash.exe in System32 and WindowsApps → still uses /usr/bin/bash
Set SHELL and CLAUDE_CODE_GIT_BASH_PATH in ~/.claude/settings.json → ignored
Downgraded CLI to v2.1.45 → same error
Added Git Bash to system PATH → system finds it, Claude Code doesn't
The Bash tool appears to hardcode /usr/bin/bash rather than respecting SHELL env var or system PATH. All other Claude Code tools (Read, Edit, Write, Grep, Glob) work fine — only the Bash tool is broken.
I have stayed on 2.1.45 which works, if i upgrade its unusable. I guess we have to wait for this to be fixed before we can use the latest.
This is not a duplicate of either #25691 or #25628. While all three involve special characters in Windows usernames breaking the Bash tool, they are distinct bugs at different layers with different root causes and fixes:
| Issue | Character | Error | Root Cause | Fix Required |
|-------|-----------|-------|------------|--------------|
| #25691 | Spaces (
First Last) |Permission denied(word-splitting) | Unquoted variable expansion in wrapper script | Double-quote variables || #25628 | Periods (
user.DOMAIN) |fatal error - add_item(MSYS2 hang) | Upstream MSYS2/Cygwin path translation bug | Alternative shell support or upstream fix || #26742 | Apostrophes (
O'Connor) |unexpected EOF while looking for matching '| Unescaped'inbash -ccommand string | Escape single quotes before interpolating paths |Specifically, this issue occurs because the apostrophe in the username path (e.g.,
C:\Users\PaulO'Connor\) is a shell quote delimiter. When Claude Code interpolates this path into abash -c '...'command, the'terminates the string early, creating an unterminated quote — hence theunexpected EOFsyntax error. Every Bash tool call fails with exit code 2.This is a Claude Code escaping bug, not a word-splitting issue (#25691) or an MSYS2 runtime crash (#25628). Different root cause, different failure mode, different fix.
This issue is persisting for me as well
No movement on this? @claude fix this one already. Haven't been able to update in 3 weeks.
It looks like Claude Code stable channel is now 2.1.58 which has this bug. I installed 2.1.44 which works for me.
C:\Users\<user_name>\.claude\settings.jsonfile, set the following:``
``{
"env": {
"DISABLE_AUTOUPDATER": "1"
},
"minimumVersion": "2.1.44",
"autoUpdates": false
}
``
``irm https://claude.ai/install.ps1 | iex
bootstrap.ps1script..\bootstrap.ps1 -Target 2.1.44to downgrade to 2.1.44.@claude Any update on this. Would love to use the new cowork and other feature but cannot update my claude code.
Still happening in 2.1.76.
Any updates on this? So frustrating.
This issue is fixed for me in v2.1.81 (latest as I write these lines).
I think the following changelog entry in 2.1.77 is the fix:
They likely escaped the path and fixed the issue with the apostrophe at the same time.
Yes, it appears to be fixed for me also using
2.1.81EDIT: Actually seeing this still in some areas like hooks.
It was working, until it hits hooks.
node -e "const fs=require('fs'); const c=fs.readFileSync('E:/Company/AgentChecklist/js/data/phases.js','utf8'); const idx=c.indexOf('\"id\": \"phase10\"'); const b=c.lastIndexOf('{',idx); const nl=c.lastIndexOf('\\n',b); fs.writeFileSync('/tmp/phases_top.txt',c.substring(0,nl),'utf8'); console.log('top saved, len='+c.substring(0,nl).length);":
Exit code 2
/usr/bin/bash: -c: line 10: unexpected EOF while looking for matching `''
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.