Bash tool: env vars with spaces in values cause zsh startup errors

Resolved 💬 3 comments Opened May 13, 2026 by MLKiiwy Closed May 17, 2026

Description

When running Claude Code as a VS Code extension, the Bash tool spawns zsh subshells that produce spurious errors before every command. The errors are cosmetic (commands still execute correctly) but noisy.

Error output (appears before every command)

zsh:19: permission denied: /run/current-system/sw
zsh:23: no such file or directory: Support/Code/CachedData/8b640eef5a6c6089c029249d48efa5c99adf7d51
zsh: command not found: 36:ln=35:so=32:pi=33:ex=31:bd=34
zsh: command not found: 46:cd=34
zsh:33: no such file or directory: Support/Code/1.11-main.sock
zsh: command not found: -R

Root cause

VS Code sets environment variables whose values contain spaces:

  • VSCODE_CODE_CACHE_PATH=/Users/mikael/Library/Application Support/Code/CachedData/...
  • VSCODE_IPC_HOOK=/Users/mikael/Library/Application Support/Code/1.11-main.sock

When the Bash tool generates its shell wrapper/snapshot script, it embeds these env var values without quoting. Zsh then splits on the space — Application Support becomes two tokens — and tries to execute Support/Code/... as a command.

The errors persist even with ZDOTDIR=/tmp HOME=/tmp zsh --no-rcs --no-globalrcs -c 'echo ok', confirming the issue is in the wrapper generated by Claude Code, not in any user startup file.

Environment

  • Claude Code version: 2.1.140
  • Platform: macOS (darwin arm64)
  • Shell: zsh
  • VS Code version: 1.11
  • Running as: VS Code extension (CLAUDE_CODE_ENTRYPOINT=claude-vscode)

Expected behavior

Env var values containing spaces should be quoted when embedded in generated shell scripts, so Application Support is not split into separate tokens.

Workaround

No workaround found yet.

View original on GitHub ↗

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