Shell snapshot captures set -o onecmd — breaks shell after one command (recurring)
Resolved 💬 3 comments Opened Feb 7, 2026 by oscarbds Closed Feb 7, 2026
Bug Description
Shell snapshots at ~/.claude/shell-snapshots/snapshot-bash-*.sh incorrectly capture set -o onecmd. When Claude Code loads these snapshots, bash exits after executing a single command, breaking all subsequent operations.
Evidence
set -o onecmdis NOT present in~/.bashrc,~/.bash_profile, or/etc/profile- Running
set -o | grep onecmdshowsonecmd off - Despite this, Claude Code snapshots contain
set -o onecmd(observed at line 45) - This has occurred 5 times over multiple months
Reproduction Pattern
- Start Claude Code
- Shell snapshot is created/loaded
- Snapshot contains
set -o onecmd - Shell breaks (exits after one command)
- Workaround: delete corrupted snapshots (
rm -f ~/.claude/shell-snapshots/*.sh) - Next session: new snapshot created with the same bug
Proposed Fix
Add a blocklist to the snapshot capture logic to filter out destructive shell options:
onecmd — exits shell after one command
errexit — exits on any error
nounset — exits on undefined variable
pipefail — changes pipeline error handling
These options should never be persisted in snapshots as they fundamentally change shell behavior in destructive ways.
Environment
- OS: macOS (Darwin)
- Shell: bash 3.2.57
- Claude Code: installed via Homebrew
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗