[BUG] claude-shell-snapshot-* has a syntax error when using Oh My Zsh
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.17 (Claude Code)
- Operating System: macOS 15.5
- Terminal: iTerm2 v3.5.14
Bug Description
I am using Oh My Zsh. Every time Claude Code is executed (at least in interactive mode), it creates a snapshot of the shell environment at a path like /var/folders/0f/kqpdpv050ggbk_j53dfm84f40000gn/T/claude-shell-snapshot-c773.
Any attempt to execute a bash command from within claude code results in an error like this:
! ls
⎿ /var/folders/0f/kqpdpv050ggbk_j53dfm84f40000gn/T/claude-shell-snapshot-29b4:1010: parse error near `()'
The offending line is always this line within the omz_urlencode function:
local mark='_.!~*'()-'
As you can see, that is an unterminated string. The ' in the middle of that string is not escaped. Thus the error on every bash command.
Steps to Reproduce
- Install Oh My Zsh
- Run
claudefrom the terminal. - Enter
!to enter bash mode and thenls
Expected Behavior
bash commands execute without that parse error.
Actual Behavior
Every bash command executed by claude code results in that parse error.
Additional Context
I asked claude code for a workaround, but ultimately had to disable Oh My Zsh.
This issue has 12 comments on GitHub. Read the full discussion on GitHub ↗