Bash tool: unquoted redirect path breaks on Windows usernames with spaces

Resolved 💬 3 comments Opened Mar 9, 2026 by EdenGibson Closed Mar 13, 2026

Bug

The Bash tool's CWD-tracking redirect path is not quoted, causing a "Permission denied" error on every command when the Windows username contains a space.

Reproduction

  1. Use Claude Code on Windows (Git Bash / MSYS2) with a username containing a space (e.g. Eden Gibson)
  2. Run any Bash command (e.g. date)
  3. Observe: /usr/bin/bash: line 1: /c/Users/Eden: Permission denied on every invocation

Root cause

BASH_EXECUTION_STRING reveals the command Claude Code constructs:

source '/c/Users/Eden Gibson/.claude/shell-snapshots/snapshot-....sh' \
  && shopt -u extglob 2>/dev/null || true \
  && eval "..." \
  && pwd -P >| /c/Users/Eden Gibson/AppData/Local/Temp/claude-8958-cwd

The source path is correctly single-quoted. However, the redirect target at the end is unquoted:

pwd -P >| /c/Users/Eden Gibson/AppData/Local/Temp/claude-8958-cwd

Bash interprets this as:

  • pwd -P >| /c/Users/Eden (redirect to /c/Users/Eden, a directory → fails)
  • Gibson/AppData/Local/Temp/claude-8958-cwd (executed as a command → "Permission denied")

Expected fix

Quote the redirect path:

pwd -P >| '/c/Users/Eden Gibson/AppData/Local/Temp/claude-8958-cwd'

Impact

  • Error noise on every Bash tool invocation
  • Exit code is always 1 regardless of actual command success
  • Extra tokens consumed per round-trip

Environment

  • Platform: Windows 11 (MSYS2 / Git Bash)
  • Shell: /usr/bin/bash
  • OS: MSYS_NT-10.0-26200 3.6.4-b9f03e96.x86_64

View original on GitHub ↗

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