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:

  1. Skip aliases whose names can't be represented in bash (like -)
  2. Use bash-compatible syntax for these aliases
  3. Suppress errors from alias restoration so they don't pollute every command's output

Reproduction

  1. Use zsh with oh-my-zsh (which defines alias -- -='cd -')
  2. Start a Claude Code session
  3. 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

View original on GitHub ↗

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