Windows: tool-called PowerShell fails before command execution, even for trivial commands like 'exit 0'
Resolved 💬 2 comments Opened Apr 18, 2026 by aahljhljhlj-ux Closed Apr 18, 2026
Windows: tool-called PowerShell fails before command execution, even for trivial commands like 'exit 0'
What version of Codex is running?
codex-cli 0.121.0
Which model were you using?
gpt-5.4
What platform is your computer?
Windows
What issue are you seeing?
When Codex invokes PowerShell through its shell tool, the tool call fails before the actual command executes.
This does not appear to be a general PowerShell issue on the host machine. PowerShell can be launched manually outside Codex, but Codex tool calls fail immediately, even for trivial commands.
What steps can reproduce the bug?
- Start Codex on Windows
- Ask Codex to run a simple shell command, for example:
exit 0Write-Output hello[Environment]::CurrentDirectory
- Observe that the tool call fails before the command actually runs
What is the expected behavior?
Codex should successfully start PowerShell and execute the requested command.
What do you see instead?
The tool call fails immediately.
Observed behavior:
- exit code:
-65536 - output includes:
0x8009001d
Example failing commands:
exit 0
Write-Output hello
[Environment]::CurrentDirectory
Additional information
Manual PowerShell invocation outside Codex works normally, so this appears to be specific to Codex's shell/tool execution path rather than PowerShell itself.
Impact:
- shell commands cannot be executed reliably from Codex
- environment setup commands are blocked
- file inspection and edit workflows are blocked
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗