Bash tool: unquoted temp path causes 'Permission denied' on Windows with spaces in VSCode path
Resolved 💬 3 comments Opened Feb 24, 2026 by PeterSawatzki-MGGM Closed Feb 24, 2026
Bug Description
Every Bash tool invocation produces the error:
/usr/bin/bash: line 1: /c/Program: Permission denied
The exit code is always 1 (even when the actual command succeeds), and all output appears doubled.
Root Cause
The extension appends a pwd -P >| <temp_path> suffix to every bash command to track the current working directory between invocations. The temp path is derived from VSCODE_PORTABLE / VSCode's data directory and is not quoted in the bash command string.
The full BASH_EXECUTION_STRING looks like:
source /c/Users/<user>/.claude/shell-snapshots/snapshot-bash-<id>.sh \
&& shopt -u extglob 2>/dev/null || true \
&& eval '<user_command>' \< /dev/null \
&& pwd -P >| /c/Program Files/VSCode/data/tmp/claude-c40c-cwd
The last part is the problem:
pwd -P >| /c/Program Files/VSCode/data/tmp/claude-c40c-cwd
Bash parses this as:
pwd -P >| /c/Program(redirect stdout to/c/Program, which is a directory → Permission denied)Files/VSCode/data/tmp/claude-c40c-cwd(treated as a separate command)
Expected Behavior
The temp path should be quoted:
pwd -P >| "/c/Program Files/VSCode/data/tmp/claude-c40c-cwd"
Environment
- OS: Windows 11 Pro (Git Bash / MSYS2)
- VSCode: Portable installation at
C:\Program Files\VSCode\(path contains a space) - VSCODE_PORTABLE:
C:\Program Files\VSCode\data - Claude Code Extension: v2.1.49 (win32-x64)
- CLAUDE_AGENT_SDK_VERSION: 0.2.49
- Shell:
/usr/bin/bash(Git Bash)
Reproduction
- Install VSCode (portable or regular) in a path containing spaces (e.g.
C:\Program Files\VSCode\) - Install the Claude Code extension
- Run any Bash tool command (even
/usr/bin/true) - Observe: exit code 1, "Permission denied" error, doubled output
Impact
- Every Bash command reports exit code 1 regardless of actual success
- Error message on every command (cosmetic but confusing)
- Output appears doubled
- Any logic depending on exit codes is broken
Workaround
Install VSCode in a path without spaces (e.g. C:\VSCode\).
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗