[BUG] [WORKAROUND] Shell snapshot duplicates -- separator when serializing alias with dash name
Resolved 💬 5 comments Opened Mar 13, 2026 by htkognic Closed May 5, 2026
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?
Shell snapshot generation incorrectly serializes bash aliases that use -- (end-of-options) with the - alias name. The snapshot duplicates the -- separator, producing alias -- -- -='popd > /dev/null' instead of alias -- -='popd > /dev/null'. This causes alias: --: not found to print on every bash command invocation in Claude Code.
What Should Happen?
The snapshot should faithfully reproduce the alias as alias -- -='popd > /dev/null' without duplicating the --.
Error Messages/Logs
/home/user/.claude/shell-snapshots/snapshot-bash-*.sh: line 3961: alias: --: not found
Steps to Reproduce
- Add these aliases to your bash config (e.g.
~/.bashrc_aliassourced from~/.bashrc):
``bash``
alias -- +='pushd . > /dev/null'
alias -- -='popd > /dev/null'
- Start Claude Code — a shell snapshot is generated under
~/.claude/shell-snapshots/ - Run any
!command (e.g.! pwd) - Observe
alias: --: not foundin the output - Inspect the snapshot file — the
-alias line readsalias -- -- -='popd > /dev/null'(doubled--)
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.74 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
- Terminal: Konsole from KDE Plasma 6, bash 5.2.37 (aarch64-unknown-linux-gnu)
- The
+alias (alias -- +='pushd . > /dev/null') on the preceding line is serialized correctly. Only the-name triggers the duplication, suggesting the snapshot logic treats bare-as a flag and defensively prepends--. - Related shell snapshot issues: #33079, #31910, #33854
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗