Shell snapshot generation drops first character of shopt output
Resolved 💬 3 comments Opened Jan 19, 2026 by sweetrb Closed Jan 23, 2026
Description
When Claude Code generates shell snapshots in ~/.claude/shell-snapshots/, the first shopt line has its leading s character dropped, resulting in hopt instead of shopt.
Steps to Reproduce
- Start a Claude Code session on Windows with Git Bash
- Let Claude Code generate a shell snapshot
- Observe the snapshot file contents
Expected Behavior
Line 25 should read:
shopt -u localvar_unset
Actual Behavior
Line 25 reads:
hopt -u localvar_unset
This causes the error:
/c/Users/rob/.claude/shell-snapshots/snapshot-bash-XXXXX.sh: line 25: hopt: command not found
Environment
- OS: Windows 11 (MINGW64_NT-10.0-26200)
- Shell: Git Bash (MSYS2)
- Claude Code Bash tool uses
/usr/bin/bash
Evidence
The bug is reproducible - deleting the snapshot and letting Claude Code regenerate it produces the same error. The issue appears to be in the snapshot generation logic, not a one-time corruption.
Example from generated snapshot:
alias -- ~='cd ~'
hopt -u localvar_unset # <-- missing 's' at start
shopt -s login_shell # <-- subsequent lines are correct
shopt -u mailwarn
Workaround
Manually fix the file:
sed -i 's/^hopt /shopt /' ~/.claude/shell-snapshots/snapshot-bash-*.sh
This fix is lost when Claude Code regenerates the snapshot.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗