[BUG] PowerShell tool fails with "Command line is invalid" on Windows (Japanese locale) since v2.1.124
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 tool fails to execute any command on Windows since v2.1.124. Even trivial calls like Write-Output "hello" exit with code 1 and empty stdout. The failure occurs before pwsh.exe starts — Windows rejects the command line at the CreateProcess level (Win32 error 87, ERROR_INVALID_PARAMETER).
Environment:
- Claude Code VSCode extension, v2.1.126 (broken), v2.1.123 (works)
- Windows 11 Pro 10.0.26200, Japanese system locale (CP932)
- PowerShell 7.x (
pwsh.exe); functions normally in external terminals both with and without profile - The Bash tool inside Claude Code works fine on the same machine, so the regression is specific to the PowerShell tool's argument-construction path
Suspected cause: A change to PowerShell argument quoting/escaping introduced in v2.1.124, v2.1.125, or v2.1.126 produces an argument string Windows rejects. Possible candidates: unbalanced or doubled quoting of -Command, embedded characters (newlines, backticks, quotes) not escaped for the Win32 command-line parser, or total argument length exceeding a Windows-imposed limit when the tool wraps the command in additional scaffolding.
The fact that stderr comes back in Shift-JIS / ANSI rather than UTF-8 suggests the spawn path is using CreateProcessA (or otherwise inheriting the system ANSI codepage). Users on en-US locales may not have noticed because their stderr would be readable English.
I haven't bisected v2.1.124 / v2.1.125 / v2.1.126 individually — I went straight from 2.1.126 (broken) to 2.1.123 (works). Happy to test specific intermediate versions if that would help narrow down the offending commit.
What Should Happen?
The PowerShell tool should execute the supplied command via pwsh.exe and capture its stdout/stderr. For Write-Output "hello", the tool result should contain hello and exit code 0.
Workaround until fixed: roll back the extension to v2.1.123 via the VSCode Extensions view → gear icon → "Install Another Version...", and disable Auto Update for the extension to prevent re-upgrade.
Error Messages/Logs
From the VSCode Output panel (Claude Code channel) on every PowerShell tool invocation:
[DEBUG] PowerShell parser: pwsh exited 1: �R�}���h ���C�����������܂��B (attempt 1)
[DEBUG] PowerShell parser: pwsh exited 1: �R�}���h ���C�����������܂��B (attempt 2)
[DEBUG] PowerShell parser: pwsh exited with code 1, stderr: �R�}���h ���C�����������܂��B
[WARN] [Stall] tool_dispatch_end tool=PowerShell ... outcome=error durationMs=7
[DEBUG] PowerShell tool error (7ms): Shell command failed
The stderr is mojibake — Shift-JIS bytes rendered as UTF-8. Decoded:
> **コマンド ラインが正しくありません**
> ("The command line is invalid")
This is the localized Japanese form of Win32 `ERROR_INVALID_PARAMETER` (error 87) from `CreateProcess`. The 7 ms `durationMs` confirms the failure is at process-spawn time, not inside `pwsh`.
Steps to Reproduce
- Install Claude Code VSCode extension v2.1.126 on a Japanese-locale Windows 11 machine.
- Open any project and start a Claude Code session.
- Ask Claude to invoke a trivial PowerShell command, e.g. "Run
Write-Output 'hello'via the PowerShell tool". - Observe: the tool returns exit code 1 with empty stdout. The Claude Code Output panel shows the
pwsh exited 1lines above. - Roll back to v2.1.123 (Extensions → Claude Code → gear → "Install Another Version...") and repeat step 3 —
hellois returned correctly.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
cc_version=2.1.126.e01
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗