[BUG] Bash tool fails on Windows when user profile path contains apostrophe

Resolved 💬 6 comments Opened Feb 25, 2026 by davidreilly007 Closed Apr 6, 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?

All Bash tool calls fail when the Windows user profile path contains an apostrophe (e.g., C:\Users\John's
Precision
). Every command — even echo hello — fails with:

/usr/bin/bash: -c: line 1: unexpected EOF while looking for matching '

What Should Happen?

Bash commands execute normally regardless of characters in the user profile path.

Error Messages/Logs

Steps to Reproduce

  1. Have a Windows user account with an apostrophe in the name (e.g., "John's Precision")
  2. Launch Claude Code from any directory
  3. Attempt any Bash tool call (e.g., echo hello, pwd, ls)

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.58

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

## Actual Behavior

Every Bash command fails with exit code 2 and the unmatched quote error. The user's home directory path appears to be
interpolated into the shell command string without proper escaping.

## Environment

  • OS: Windows 11 Pro 10.0.26200
  • Shell: bash (Git Bash / MSYS2)
  • User profile path: C:\Users\John's Precision
  • Claude Code model: claude-opus-4-6

## Workaround

None currently. All non-Bash tools (Read, Write, Edit, Glob, Grep) work fine. Only the Bash tool is affected.

## Notes

  • Disabling sandbox (dangerouslyDisableSandbox: true) does not fix the issue
  • All plugin hooks were already disabled — the problem is in the Bash tool's command wrapper itself
  • The apostrophe in the path is likely being single-quoted without escaping somewhere in the command construction

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗