[BUG] Shell snapshot files interfering with PowerShell execution on Windows

Resolved 💬 3 comments Opened Nov 6, 2025 by CaptinShawn Closed Nov 10, 2025

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?

Bug Description:

Claude Code's shell snapshot mechanism is causing terminal crashes on Windows due to snapshot file paths being
incorrectly injected into PowerShell command execution.

Technical Details:

When Claude Code executes bash commands on Windows, it creates shell snapshot files in ~/.claude/shell-snapshots/
(e.g., snapshot-bash-1762459922137-tz1ght.sh). These snapshot file paths are being incorrectly interpolated into
subsequent PowerShell commands, causing PowerShell to interpret them as cmdlet or function names.

For example, when executing:
powershell -Command "Get-Process | Where-Object {$_.ProcessName -like 'powershell'}"

The actual command received by PowerShell becomes something like:
Get-Process | Where-Object {/c/Users/2653728/.claude/shell-snapshots/snapshot-bash-17...sh.ProcessName -like
'powershell'}

This results in hundreds of CommandNotFoundException errors as PowerShell tries to resolve the snapshot file path as
a command.

Impact:

  • Terminal sessions become unstable and crash randomly/unpredictably
  • PowerShell commands fail with cascading errors
  • Terminal output becomes unreadable due to repeated error messages
  • Makes Claude Code unusable for Windows users experiencing this issue

Expected Behavior:

Shell snapshot files should be isolated from command execution and should not interfere with PowerShell or bash
command processing.

What Should Happen?

  1. Shell snapshot files should be managed internally by Claude Code without interfering with command execution
  2. PowerShell commands should execute cleanly without snapshot file paths being injected into the command syntax
  3. Bash and PowerShell commands should run in isolation from each other's state management
  4. Terminal sessions should remain stable during normal Claude Code operations
  5. Shell snapshot files should either:
  • Be stored in a way that doesn't conflict with command execution, OR
  • Be automatically cleaned up after use, OR
  • Be kept completely separate from the command execution pipeline

In short: Users should be able to run bash and PowerShell commands through Claude Code without experiencing crashes,
errors, or interference from internal Claude Code mechanisms like shell snapshots.

Error Messages/Logs

Steps to Reproduce

  1. Install Claude Code version 2.0.34 on Windows
  2. Start a Claude Code session in any directory
  3. Execute multiple bash commands through Claude Code (e.g., ls, dir, basic git commands)
  4. Observe that shell snapshot files accumulate in ~/.claude/shell-snapshots/ directory
  5. Execute PowerShell commands that use Where-Object or other cmdlets with script blocks
  • Example: powershell -Command "Get-Process | Where-Object {$_.ProcessName -like 'powershell'}"
  1. Observe that the command fails with CommandNotFoundException errors
  2. Notice that snapshot file paths (e.g.,

/c/Users/USERNAME/.claude/shell-snapshots/snapshot-bash-XXXXXXXXX.sh.ProcessName) appear in the error messages

  1. Continue using Claude Code - terminal becomes increasingly unstable
  2. Terminal crashes randomly/unpredictably during normal operations

Note: The issue appears to occur randomly but becomes more frequent as more shell snapshots accumulate. Restarting
Claude Code may temporarily resolve the issue, but it recurs during subsequent sessions.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Sonnet Sonnet 4.5 · Smartest model for daily use · $3/$15 per Mtok ✔

Claude Code Version

2.0.34

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

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