[BUG] Shell Snapshot Generates Invalid Commands

Resolved 💬 2 comments Opened Jan 4, 2026 by Henry-Bonikowsky Closed Jan 17, 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?

Root Cause

The shell snapshot generation is incorrectly parsing bash options from set -o output, creating standalone invalid commands instead of proper set -o statements.

Snapshot Content (lines 3-5):

or # INVALID - should be "set -o monitor" set -o onecmd # CORRECT heckhash # INVALID - should be "set -o hashall"

Shell snapshots contain invalid standalone commands or and heckhash that cause "command not found" errors.

What Should Happen?

Shell snapshots should generate valid bash commands that can be sourced without errors.

Actual Snapshot Content (lines 3-5):

or # INVALID - should be "set -o monitor" set -o onecmd # CORRECT heckhash # INVALID - should be "set -o hashall"

Error Messages/Logs

Every bash command execution produces these errors:

>     /c/Users/henry/.claude/shell-snapshots/snapshot-bash-*.sh: line 3: or: command not found
>     /c/Users/henry/.claude/shell-snapshots/snapshot-bash-*.sh: line 5: heckhash: command not found

Steps to Reproduce

Steps to Reproduce

  1. Use Claude Code on Windows with Powershell/Git Bash Mingw64
  2. Have monitor and/or hashall bash options enabled
  3. Execute any bash command via Claude Code
  4. Observe the errors in output

Claude Model

Not sure / Multiple models

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.0.76

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Powershell/Git Bash(MINGW64)

Additional Information

Additional Context

The bug appears to be in the snapshot generation logic that processes the output of set -o. It's likely:

  • Missing the set -o prefix for certain options
  • Incorrectly truncating option names (e.g., "monitor" → "or", "hashall" → "heckhash")

Attempted Workarounds (All Failed)

  1. Modifying user .bashrc to disable options - file modification fails
  2. Deleting snapshot files - regenerated with same bug
  3. Using bash --noprofile --norc - snapshots still sourced
  4. Editing snapshot files directly - overwritten immediately

View original on GitHub ↗

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