codex - 💡(How to fix) Fix exec_command tool consistently fails with "Failed to create unified exec process: No such file or directory (os error 2)" [1 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#20770Fetched 2026-05-03 04:45:50
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×3unlabeled ×1

The exec_command tool fails on every invocation with:

CreateProcess { message: "Rejected(\"Failed to create unified exec process: No such file or directory (os error 2)\")" }

This makes it impossible for the Codex agent to run any shell command inside the session — pwd, ls, sqlite3, anything.

Error Message

exec_command tool consistently fails with "Failed to create unified exec process: No such file or directory (os error 2)" CreateProcess { message: "Rejected("Failed to create unified exec process: No such file or directory (os error 2)")" }

  1. Tool fails with the error above; no shell command executes level=ERROR target=codex_core::session::handlers error=exec_command failed for /bin/zsh -lc "<command>": CreateProcess { message: "Rejected("Failed to create unified exec process: No such file or directory (os error 2)")" } The error suggests Codex is trying to spawn a helper binary (unified-exec of some sort) that's missing or unreachable from where it's looking. which zsh returns /bin/zsh cleanly; not a shell-binary issue.

Root Cause

The exec_command tool fails on every invocation with:

CreateProcess { message: "Rejected(\"Failed to create unified exec process: No such file or directory (os error 2)\")" }

This makes it impossible for the Codex agent to run any shell command inside the session — pwd, ls, sqlite3, anything.

Fix Action

Workaround

None — the tool is fully blocked. User has to copy-paste commands into a separate Terminal window, defeating the agentic-coding workflow.

Code Example

CreateProcess { message: "Rejected(\"Failed to create unified exec process: No such file or directory (os error 2)\")" }

---

level=ERROR target=codex_core::session::handlers
error=exec_command failed for `/bin/zsh -lc "<command>"`:
CreateProcess { message: "Rejected(\"Failed to create unified exec process: No such file or directory (os error 2)\")" }
RAW_BUFFERClick to expand / collapse

Codex bug: exec_command fails with "Failed to create unified exec process"

Suggested title for the issue:

exec_command tool consistently fails with "Failed to create unified exec process: No such file or directory (os error 2)"

Suggested repo: openai/codex


Description

The exec_command tool fails on every invocation with:

CreateProcess { message: "Rejected(\"Failed to create unified exec process: No such file or directory (os error 2)\")" }

This makes it impossible for the Codex agent to run any shell command inside the session — pwd, ls, sqlite3, anything.

Environment

  • codex-cli: 0.128.0 (also reproduced on 0.125.0)
  • macOS: 14.x (Apple Silicon iMac)
  • Shell: zsh 5.9 (default macOS)
  • Installed via npm install -g @openai/codex

Reproduction

  1. Launch Codex with codex from a fresh Terminal session
  2. Inside Codex, prompt: Run "pwd" and tell me the result
  3. Codex's LLM invokes the exec_command tool
  4. Tool fails with the error above; no shell command executes

Things tried that did NOT fix it

  • Updating from 0.125.0 to 0.128.0 (npm install -g @openai/codex@latest) — the bug persists
  • rm -rf ~/.codex/.tmp ~/.codex/shell_snapshots/* — issue returned in subsequent sessions
  • Restarting Terminal / opening fresh shells

Diagnostic from ~/.codex/logs_2.sqlite

level=ERROR target=codex_core::session::handlers
error=exec_command failed for `/bin/zsh -lc "<command>"`:
CreateProcess { message: "Rejected(\"Failed to create unified exec process: No such file or directory (os error 2)\")" }

The error suggests Codex is trying to spawn a helper binary (unified-exec of some sort) that's missing or unreachable from where it's looking. which zsh returns /bin/zsh cleanly; not a shell-binary issue.

Expected behavior

exec_command spawns the shell, runs the requested command, returns its stdout/stderr.

Workaround

None — the tool is fully blocked. User has to copy-paste commands into a separate Terminal window, defeating the agentic-coding workflow.

extent analysis

TL;DR

The exec_command tool fails due to a missing or unreachable helper binary, suggesting a potential issue with the unified-exec process.

Guidance

  • Verify the existence and accessibility of the unified-exec binary, which might be required by the exec_command tool.
  • Check the codex installation and configuration to ensure that the unified-exec binary is properly installed and configured.
  • Investigate the error message "No such file or directory (os error 2)" to determine if it's related to a specific file or directory that the exec_command tool is trying to access.
  • Consider checking the ~/.codex/logs_2.sqlite log file for more detailed error messages or clues about the issue.

Example

No code snippet is provided as the issue seems to be related to a missing binary or configuration issue.

Notes

The issue might be specific to the codex-cli version 0.128.0 or the macOS 14.x environment, and further investigation is needed to determine the root cause.

Recommendation

Apply workaround: Try to manually install or configure the unified-exec binary, if possible, to see if it resolves the issue. If not, consider reaching out to the openai/codex maintainers for further assistance.

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

exec_command spawns the shell, runs the requested command, returns its stdout/stderr.

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 exec_command tool consistently fails with "Failed to create unified exec process: No such file or directory (os error 2)" [1 participants]