claude-code - 💡(How to fix) Fix [BUG] Bash tool: env vars with spaces in values cause zsh startup errors

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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 Message

Error output (appears before every command)

Error Messages/Logs

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.

Fix Action

Workaround

No workaround found yet.

Code Example

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

---
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

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.

What Should Happen?

The VSCode extension should quote the env variable when using them allowing Paths with spaces.

Error Messages/Logs

Steps to Reproduce

Use VSCODE_CODE_CACHE_PATH with a path that contain a space.

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

2.1.140

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

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.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Bash tool: env vars with spaces in values cause zsh startup errors