[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

  1. Add these aliases to your bash config (e.g. ~/.bashrc_alias sourced from ~/.bashrc):

``bash
alias -- +='pushd . > /dev/null'
alias -- -='popd > /dev/null'
``

  1. Start Claude Code — a shell snapshot is generated under ~/.claude/shell-snapshots/
  2. Run any ! command (e.g. ! pwd)
  3. Observe alias: --: not found in the output
  4. Inspect the snapshot file — the - alias line reads alias -- -- -='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

View original on GitHub ↗

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