[BUG] Error handling .claude/shell-snapshots/snapshot-zsh-1760627850286-hk1p23.sh
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?
While using Claude Code normally, I can see something like this which prevents any command from being run:
⏺ Bash(npm run lint)
⎿ Error: /Users/vemv/.claude/shell-snapshots/snapshot-zsh-1760627850286-hk1p23.sh:export:15: not valid in this context:
```
Screenshot:
<img width="992" height="143" alt="Image" src="https://github.com/user-attachments/assets/6df1f217-e995-48ab-a76e-5c7a6a589dcc" />
Context:
~/ext (safe-json*) $ cat /Users/vemv/.claude/shell-snapshots/snapshot-zsh-1760627850286-hk1p23.sh
Snapshot file
Unset all aliases to avoid conflicts with functions
unalias -a 2>/dev/null || true
Functions
Shell Options
setopt nohashdirs
setopt login
Aliases
alias -- run-help=man
alias -- which-command=whence
Check for rg availability
if ! command -v rg >/dev/null 2>&1; then
alias rg='/Users/vemv/.nvm/versions/node/v23.11.0/lib/node_modules/\@anthropic-ai/claude-code/vendor/ripgrep/arm64-darwin/rg'
fi
export PATH=/opt/homebrew/opt/llvm/bin:/Users/vemv/codescene/cli/target/:/Applications/Contents/Resources/app/bin/:/usr/local/opt/curl/bin:/Users/vemv/Library/Python/2.7/bin:/Users/vemv/.nvm/versions/node/v18.12.1/bin:/Users/vemv/google-cloud-sdk/bin:/usr/local/opt/gettext/bin:/Users/vemv/bin/apache-maven-3.9.9/bin:/Users/vemv/bin/apache-maven-3.8.6/bin:/usr/local/opt/postgresql@9.6/bin:/usr/local/opt/gpg2/bin:/usr/local/bin:/Users/vemv/bin:/Users/vemv/.rbenv/bin:/usr/local/go/bin:/Users/vemv/.local/bin:/opt/homebrew/opt/mysql@8.4/bin:/Users/vemv/.rbenv/shims:/opt/homebrew/opt/llvm/bin:/Users/vemv/codescene/cli/target/:/Applications/Visual Studio Code.app/Contents/Resources/app/bin/:/usr/local/opt/curl/bin:/Users/vemv/Library/Python/2.7/bin:/Users/vemv/.nvm/versions/node/v18.12.1/bin:/Users/vemv/google-cloud-sdk/bin:/usr/local/opt/gettext/bin:/Users/vemv/bin/apache-maven-3.9.9/bin:/Users/vemv/bin/apache-maven-3.8.6/bin:/usr/local/opt/postgresql@9.6/bin:/usr/local/opt/gpg2/bin:/usr/local/bin:/Users/vemv/bin:/Users/vemv/.rbenv/bin:/usr/local/go/bin:/Users/vemv/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Applications/Emacs.app/Contents/MacOS/bin-arm64-12:/Applications/Emacs.app/Contents/MacOS/libexec-arm64-12:/Users/vemv/go/bin:/usr/local/sbin:/Users/vemv/go/bin:/usr/local/sbin
The problem appears to be that `/Visual Studio Code.app` is in the path, and that whitespace breaks the `export`.
### What Should Happen?
No errors
### Error Messages/Logs
```shell
Steps to Reproduce
Might be reproduced by adding /Applications/Visual Studio Code.app/Contents/Resources/app/bin" to the path.
Either way, very clearly Claude Code is generating a snapshot-zsh-*.sh file that has invalid syntax due to the lack of escaping.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Latest
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗