Home/Wiki Errors/OpenAI Codex
OpenAI Codex / Windows sandbox

CreateProcessWithLogonW failed: 5 - Codex Windows sandbox

Codex attempted to start a sandboxed command on Windows and received access denied from the operating system.

CreateProcessWithLogonW failed 5 CodexCodex Windows sandbox command execution failsCodex access denied sandbox
Paste an error to match it against the wiki. / 粘贴报错后自动匹配。

Error text / 报错原文

  • CreateProcessWithLogonW failed: 5

What it means

Codex attempted to start a sandboxed command on Windows and received access denied from the operating system.

Most common causes

  • Windows account policy blocks the logon method used by the sandbox
  • The workspace is under a restricted directory
  • Security software prevents the helper process from launching
  • Native Windows sandbox mode is incompatible with the current environment

Fastest fix

  • Move the workspace under a normal user directory
  • Try the documented Windows sandbox mode for your build
  • Restart Codex after changing sandbox settings
  • Run a simple command like whoami before a full agent task

Safe fix

  • Keep workspace paths narrow and Git-backed
  • Use WSL for Linux-heavy projects
  • Audit local security policy instead of disabling protection wholesale
  • Capture sandbox logs before changing permissions

What not to do

  • Do not grant broad write access to C:\ or WindowsApps
  • Do not run arbitrary project commands elevated
  • Do not turn off antivirus globally

How to confirm the fix

Run the smallest reproducible command first, then retry the agent task only after authentication, quota, and tool discovery are stable.

whoami /all
Get-Location
Get-ChildItem $env:USERPROFILE\.codex -Recurse -Filter *sandbox*

Related errors

Related tools

Sources