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
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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?

  1. Start Codex on Windows
  2. Ask Codex to run a simple shell command, for example:
  • exit 0
  • Write-Output hello
  • [Environment]::CurrentDirectory
  1. 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

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 4 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #18451
  • #16780

Powered by Codex Action

aahljhljhlj-ux · 4 months ago

Thanks. After comparing the linked issues, this looks much closer to #13917 than to #18451. The key symptom here is that Codex-hosted PowerShell fails before command execution with 8009001d, while manual PowerShell outside Codex works normally.\n\nSince #13917 was already marked by a collaborator as a duplicate of #9062, I am closing this as a duplicate of #9062 to consolidate tracking there.