[BUG] Claude Code repeatedly uses Bash syntax (extglob) on Windows PowerShell and fails to adapt

Resolved 💬 5 comments Opened Feb 25, 2026 by pm0code Closed Mar 25, 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?

When running Claude Code on a Windows machine, the agent attempts to execute Linux/Bash specific shell features (specifically extglob) inside PowerShell. When PowerShell returns a standard "term is not recognized" error, the agent fails to understand the OS context, does not self-correct to use PowerShell-native commands, and gets stuck repeatedly trying to execute the same incompatible command.

What Should Happen?

Claude Code should recognize the Windows/PowerShell environment and translate Bash-centric file operations into their PowerShell equivalents (e.g., using Get-ChildItem, Where-Object, or standard regex). Upon receiving a PowerShell error, it should immediately recognize the shell mismatch and self-correct.

Error Messages/Logs

`extglob.CommandLine: The term 'extglob.CommandLine' is not recognized as a name of a cmdlet, function, script file, or executable program.`

Steps to Reproduce

  1. Run Claude Code in a Windows PowerShell environment.
  2. [What prompt did you use? e.g., "Find all files matching this pattern..." or "Delete all files except..."]
  3. Claude Code attempts to run a bash command using extglob.
  4. PowerShell throws the cmdlet recognition error.
  5. Claude reads the error but fails to pivot to Windows commands, often repeating the mistake.

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.56

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗

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