codex - 💡(How to fix) Fix Windows app 26.422.8496.0: all shell commands fail with "batch file arguments are invalid" after update [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19952Fetched 2026-04-29 06:24:49
View on GitHub
Comments
2
Participants
2
Timeline
9
Reactions
0
Timeline (top)
labeled ×5commented ×2unlabeled ×2

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.

Error Message

Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" }) Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })

Root Cause

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.

Code Example

Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })

---

Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })

---

C:\Users\<USER>\AppData\Local\Microsoft\WindowsApps\pwsh.cmd
C:\Users\<USER>\AppData\Local\Programs\PowerShell\7\pwsh.exe

---

[windows]
sandbox = "elevated"

---

[windows]
sandbox = "unelevated"
RAW_BUFFERClick to expand / collapse

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

  1. Open Codex Windows app.
  2. Open any thread/workspace.
  3. Ask the agent to run a minimal command:
    • Get-Location
    • or pwd
  4. 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_CMD succeeds.
  • 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

extent analysis

TL;DR

The issue is likely due to an invalid batch file argument being passed to the PowerShell executable, and a potential workaround is to modify the Codex configuration to use a different sandbox setting or specify the full path to the PowerShell executable.

Guidance

  • Verify that the pwsh.cmd shim is not causing the issue by trying to run the command with the full path to the PowerShell executable (C:\Users\<USER>\AppData\Local\Programs\PowerShell\7\pwsh.exe).
  • Check the Codex configuration to ensure that the sandbox setting is correctly set to unelevated and restart the app to apply the changes.
  • Try specifying the full path to the PowerShell executable in the Codex configuration to see if it resolves the issue.
  • Investigate the recent Windows app and sandbox issues mentioned in the related context to see if they are related to the current problem.

Example

No code snippet is provided as it is not clearly supported by the issue.

Notes

The issue may be related to the recent Windows app and sandbox issues, and further investigation is needed to determine the root cause. The provided workaround may not be a permanent solution and may require additional changes to the Codex configuration or the Windows environment.

Recommendation

Apply workaround: Modify the Codex configuration to use a different sandbox setting or specify the full path to the PowerShell executable, as this may resolve the issue temporarily until a permanent fix is found.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The shell tool should execute minimal commands normally, or fall back to a valid PowerShell executable instead of failing during command launch.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Windows app 26.422.8496.0: all shell commands fail with "batch file arguments are invalid" after update [2 comments, 2 participants]