[Bug] PowerShell commands executed in Bash shell causing command not found errors
Bug Description
\ Bash(Get-ChildItem -Path "C:\Users\admin\source\Repos\xxx\yyy" -Recurse -File | Select-Object -ExpandProperty FullName | Sort-Object)
⎿ Error: Exit code 127
/usr/bin/bash: line 1: Get-ChildItem: command not found
/usr/bin/bash: line 1: Select-Object: command not found
/usr/bin/bash: line 1: Sort-Object: command not found
Set model to haiku (claude-haiku-4-5-20251001)
The model (Claude Code – fast) is not well trained on command execution on Windows.
On win32, it often generates PowerShell commands but tries to execute them via bash, causing errors like:
Get-ChildItem: command not found
Exit code 127
This happens very frequently on the first execution.
Usually it takes 2 or 3 retries before the model finally uses the correct syntax or shell.
Shell detection and command execution on Windows clearly need better training:
PowerShell commands should not be run in bash
Environment Info
- Platform: win32
- Terminal: visualstudio
- Version: 2.1.6
- Feedback ID: f225c012-01a0-4384-a747-246b80e9f83b
Errors
[{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server github invalid: Missing environment variables: GITHUB_PERSONAL_ACCESS_TOKEN\n at CEA (file:///C:/Users/admin/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3265:22045)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async kS0.<anonymous> (file:///C:/Users/admin/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:5164:869)\n at async kS0.parseAsync (file:///C:/Users/admin/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:4749:4156)\n at async dO7 (file:///C:/Users/admin/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:5194:1637)\n at async gO7 (file:///C:/Users/admin/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:5119:1561)\n at async lO7 (file:///C:/Users/admin/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:5196:5851)","timestamp":"2026-01-13T10:20:15.615Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server github invalid: Missing environment variables: GITHUB_PERSONAL_ACCESS_TOKEN\n at CEA (file:///C:/Users/admin/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3265:22045)\n at runNextTicks (node:internal/process/task_queues:65:5)\n at process.processImmediate (node:internal/timers:473:9)\n at async K (file:///C:/Users/admin/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2902:9458)","timestamp":"2026-01-13T10:20:19.096Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server github invalid: Missing environment variables: GITHUB_PERSONAL_ACCESS_TOKEN\n at CEA (file:///C:/Users/admin/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3265:22045)\n at runNextTicks (node:internal/process/task_queues:65:5)\n at process.processImmediate (node:internal/timers:473:9)\n at async V (file:///C:/Users/admin/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2902:9974)","timestamp":"2026-01-13T10:20:19.096Z"}]This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗