execution error: Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })
Resolved 💬 5 comments Opened Feb 18, 2026 by geocine Closed Feb 20, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex CLI is running?
codex-cli 0.103.0
What subscription do you have?
plus
Which model were you using?
gpt-5.3-codex
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What terminal emulator and version are you using (if applicable)?
Windows Terminal Git Bash
What issue are you seeing?
When running Codex CLI inside Git Bash, any command execution fails before the command is actually run. The CLI appears to attempt execution, but immediately returns:
• Permissions updated to Full Access
› help me analyze the code on this repo
• I’ll do a quick repo reconnaissance first, then map the architecture, key modules, and likely risk areas so you get a
practical code analysis. I’m starting by listing the project structure and core config files.
• Running Get-ChildItem -Force | Select-Object Name,Mode,Length,LastWriteTime
• Ran rg --files
└ execution error: Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })
• Ran git status --short
└ execution error: Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })
• The first command batch failed due command invocation formatting, so I’m retrying with direct shell calls one by one
to get the file inventory.
• Ran pwd
└ execution error: Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })
• Ran Get-Location
└ execution error: Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })
• Ran ls
└ execution error: Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })
• Ran ls
└ execution error: Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })
• Ran C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command "Get-Location"
└ execution error: Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• I’m still blocked by a shell runner error before any command executes. I’ll try one last compatibility fallback (cmd /
c dir) to confirm whether command execution is generally unavailable.
• Ran cmd /c dir
└ execution error: Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })
• Searched
• Ran echo hi
└ execution error: Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })
What steps can reproduce the bug?
- Open Windows Terminal.
- Use the Git Bash profile.
- Run codex.
- Enter a prompt that triggers repository inspection (e.g., “help me analyze the code on this repo”).
- Codex attempts to execute shell commands.
- All commands fail with:
Io(Error { kind: InvalidInput, message: "batch file arguments are invalid" })
What is the expected behavior?
Commands should execute normally (as they did in codex-cli 0.101.0) regardless of whether the shell is:
- Git Bash
- CMD
- PowerShell
~~This worked correctly in codex-cli 0.101.0 under Git Bash.~~
Additional information
In Git Bash only:
- All shell commands fail immediately.
- Even trivial commands like echo hi fail.
- The failure occurs before command execution.
- The CLI works correctly in CMD.
5 Comments
Thanks for the bug report. I suspect this is related to a recent update to
rgin this PR.seems like all commands are failing though
If you're able to repro this, please use the
/feedbackcommand to upload your logs and session details, then post the thread ID here.Can you confirm that if you downgrade to 0.101.0, the problem goes away? That will help narrow down the possible causes.
I submitted this using
/feedback; the thread ID is019c6f8e-e006-7d63-beb4-2a9de62a3802.For some reason, after downgrading to
0.101.0, the same issue still occurs. I rannpm install -g @openai/codex@0.101.0. It was definitely working prior to the upgrade.The error I’m encountering is:
Any clues on how to debug this would be greatly appreciated, as I’m trying to figure out what's going on.
For now, I'll remove
0.101.0from the description since it's puzzling that I can't get it working anymore. I am using Codex CLI on the daily on Windows Terminal + Git bashI have investigated this end to end (with codex help) and confirmed that the error was happening. However, it originated from an interaction between Codex and my local shell hardening setup.
Error:
Root cause:
pwshfrom the systemPATH.C:\Users\Aivan\.local\bin\pwsh.cmd(a custom wrapper I created), instead of directly invokingpwsh.exe.-NoProfileso that my PowerShell profile safety guardrails remain active.``
``C:\Program Files\PowerShell\7\pwsh.exe
Why this specific error occurred:
powershell_utf8is enabled, Codex prepends a UTF-8 prefix that includes a newline..cmd), which results in:``
``"batch file arguments are invalid"
So this was a compatibility edge case between Codex behavior and my local wrapper policy , not purely a fault of either side.
Fix / Mitigation:
``
``[features]
powershell_utf8 = false
Ensure
pwshresolves directly topwsh.exe, or de-prioritize/remove the custompwsh.cmdwrapper from PATH resolution during Codex runs.However, I do not intend to take this approach. The wrapper and guardrails are intentional, as I have previously experienced Codex executing destructive commands (including wiping my entire drive). The hardening layer is therefore a deliberate safety control.
Why it may reappear after upgrades or configuration changes:
powershell_utf8is enabled by default unless explicitly overridden.powershell_utf8 = falseoverride is removed during a configuration reset, profile migration, upgrade, or if the configuration file was deleted at some point, the issue can resurface.Since this behavior stems from a custom local setup, we can consider this issue closed unless there is interest in addressing it from another angle (for example, improving compatibility handling between Codex and batch wrappers).