[BUG] Shell snapshot incorrectly captures aliases starting with `-`, causing syntax error
Resolved 💬 3 comments Opened Dec 17, 2025 by 007xuyl Closed Feb 14, 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?
Claude Code's shell snapshot mechanism incorrectly captures bash aliases that start with a hyphen (-), resulting in malformed alias syntax and causing an error every time a shell command is executed.
What Should Happen?
Expected Behavior
The snapshot should preserve the correct alias syntax:
alias -- -='cd -'
Actual Behavior
The snapshot incorrectly duplicates the -- option terminator:
alias -- -- -='cd -'
Error Messages/Logs
This causes the following error on every shell command execution:
.claude/shell-snapshots/snapshot-bash-XXXXX.sh: line 4202: alias: --: not found
Steps to Reproduce
- Define a valid bash alias that starts with
-in your shell config:
```bash
alias -- -='cd -'
This is the standard bash syntax for defining aliases beginning with a hyphen.
- Run any command through Claude Code
- Claude Code creates a shell snapshot in ~/.claude/shell-snapshots/
- The snapshot file contains malformed alias syntax
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.71
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗