Windows app 26.422.8496.0: all shell commands fail with "batch file arguments are invalid" after update
Summary
After updating Codex Windows app on 2026-04-28, all agent shell commands fail before execution with:
Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })
This happens even for minimal commands such as Get-Location and pwd.
Environment
- Platform: Windows x64
- Codex app package:
OpenAI.Codex - Codex app version:
26.422.8496.0 - Package full name:
OpenAI.Codex_26.422.8496.0_x64__2p2nqsd0c76g0 - Shell context: PowerShell
Minimal repro
- Open Codex Windows app.
- Open any thread/workspace.
- Ask the agent to run a minimal command:
Get-Location- or
pwd
- The command fails immediately with:
Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })
Diagnostics already checked
Direct process launch outside the Codex shell tool works on the same machine:
cmd.exe /d /s /c echo OK_CMDsucceeds.WindowsPowerShell\v1.0\powershell.exe -NoProfile ...succeeds.- Windows PowerShell version observed:
5.1.22621.6060.
Get-Command pwsh -All shows a .cmd shim before the real PowerShell executable:
C:\Users\<USER>\AppData\Local\Microsoft\WindowsApps\pwsh.cmd
C:\Users\<USER>\AppData\Local\Programs\PowerShell\7\pwsh.exe
PowerShell 7 version observed: 7.4.15.
I also changed Codex config from:
[windows]
sandbox = "elevated"
to:
[windows]
sandbox = "unelevated"
The current thread still fails, so either the setting requires app restart or the failure occurs before this setting helps.
Expected behavior
The shell tool should execute minimal commands normally, or fall back to a valid PowerShell executable instead of failing during command launch.
Related context
There are recent Windows app / sandbox / child process environment issues, for example:
https://github.com/openai/codex/issues/18248
2 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Verified local workaround and likely root cause
I was able to recover the shell tool on this machine.
Root cause observed locally
Before the workaround,
pwshresolved first to a WindowsApps.cmdshim:The shim content was:
Launching the shim directly failed locally:
Launching the real executable worked:
Workaround that fixed Codex App
I renamed the WindowsApps shim instead of deleting it:
After that,
Get-Command pwsh -Allresolved directly to:Then I fully restarted the Codex Windows app. After restart, the shell tool recovered and a minimal tool call succeeded:
Output:
Suggested fix direction
On Windows, Codex shell resolution should probably avoid selecting
.cmd/.batshims forpwshwhen a realpwsh.exeis available later in PATH, or explicitly prefer executable candidates such as:instead of invoking the WindowsApps command shim.