[BUG] Shell snapshot injection persists in native Windows installation v1.0.107

Resolved 💬 7 comments Opened Sep 5, 2025 by shardin2 Closed Jan 12, 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?

The PowerShell shell snapshot path injection bug persists in the native Windows installation v1.0.107, despite using Anthropic's recommended native installer. Claude Code's Bash tool incorrectly injects shell snapshot file paths into PowerShell commands on Windows, causing PowerShell parser errors.

When executing PowerShell commands with pipes through the Bash tool, shell snapshot paths like /c/Users/shardin/.claude/shell-snapshots/snapshot-bash-1757050606011-7ivpf9.sh get injected mid-command, breaking PowerShell syntax and preventing command execution.

This appears to be the same core issue reported in #5868 but affects the latest native build, suggesting it's a fundamental architectural problem in Claude Code's Windows PowerShell integration.

What Should Happen?

PowerShell commands should execute normally without shell snapshot path injection. When running:

powershell.exe -Command "1..3 | ForEach-Object { 'Item ' + $_ }"

The expected output should be:

Item 1
Item 2
Item 3

Claude Code should properly isolate shell contexts and not inject bash shell snapshot file paths into PowerShell command execution, regardless of installation method (npm vs native).

Error Messages/Logs

At line:1 char:34
+ 1..3 | ForEach-Object { 'Item ' + /c/Users/shardin/.claude/shell-snap ...
+                                  ~
You must provide a value expression following the '+' operator.
At line:1 char:36
+ 1..3 | ForEach-Object { 'Item ' + /c/Users/shardin/.claude/shell-snap ...
+                                    ~
You must provide a value expression following the '/' operator.
At line:1 char:36
+ ...  'Item ' + /c/Users/shardin/.claude/shell-snapshots/snapshot-bash-175 ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token 'c/Users/shardin/.claude/shell-snapshots/snapshot-bash-1757050606011-7ivpf9.sh' in expression or 
statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : ExpectedValueExpression

Steps to Reproduce

  1. Install Claude Code using native installer:

``powershell
irm https://claude.ai/install.ps1 | iex
``

  1. Verify installation:

``bash
claude --version
`
Output:
1.0.107 (Claude Code)`

  1. Execute a PowerShell command with pipes through Claude Code's Bash tool:

``bash
powershell.exe -Command "1..3 | ForEach-Object { 'Item ' + $_ }"
``

  1. Observe the shell snapshot injection error occurs immediately

Note: Simple commands work fine (e.g., powershell.exe -Command "echo 'test'"), but any command with pipes, variables, or complex syntax triggers the injection bug.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

1.0.107 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

_No response_

View original on GitHub ↗

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