Shell snapshot incorrectly serializes zsh alias syntax for bash replay
Resolved 💬 3 comments Opened Mar 24, 2026 by samskiter Closed Mar 28, 2026
Bug
Claude Code's shell environment snapshot (~/.claude/shell-snapshots/) captures zsh aliases and replays them in bash before every command. When an alias name requires -- end-of-options syntax (e.g., oh-my-zsh's - alias for cd -), the snapshot emits:
alias -- -- -='cd -'
Bash's alias builtin doesn't support -- as an end-of-options marker, producing this error on every single bash command:
/Users/<user>/.claude/shell-snapshots/snapshot-bash-<id>.sh: line 247: alias: --: not found
Expected behavior
The snapshot should either:
- Skip aliases whose names can't be represented in bash (like
-) - Use bash-compatible syntax for these aliases
- Suppress errors from alias restoration so they don't pollute every command's output
Reproduction
- Use zsh with oh-my-zsh (which defines
alias -- -='cd -') - Start a Claude Code session
- Run any bash command — the error appears in output
Impact
Cosmetic only — the alias error doesn't break anything, but it appears on every command output, which is noisy and confusing.
Environment
- macOS (Darwin 24.6.0)
- Shell: zsh with oh-my-zsh
- Claude Code bash execution via shell snapshots
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗