Windows sandbox runner fails with CreateProcessAsUserW failed: 5 on Windows 11
What version of the Codex App are you using (From “About Codex” dialog)?
26.602.4764.0
What subscription do you have?
ChatGPT Plus
What platform is your computer?
Microsoft Windows NT 10.0.26200.8524 x64
What issue are you seeing?
Codex Desktop is unable to execute any command inside the Windows sandbox.
All commands fail before execution with:
windows sandbox: runner error: CreateProcessAsUserW failed: 5
The command itself never starts.
The same commands execute successfully outside the sandbox via escalation.
Examples:
git status
Get-Location
dir
Additional log messages observed:
computer-use native pipe startup failed
Windows Computer Use helper paths are unavailable
Earlier logs also contained:
EBUSY: resource busy or locked
After clearing plugin caches and allowing bundled plugins to reinstall, the issue persists.
What steps can reproduce the bug?
- Open Codex Desktop on Windows 11.
- Use a configuration with:
[windows]
sandbox = "elevated"
- Open a trusted project.
- Ask Codex to execute a simple command in sandbox mode:
git status
or
Get-Location
or
dir
- The command fails immediately.
Observed result:
windows sandbox: runner error: CreateProcessAsUserW failed: 5
The process is never created and the command never starts executing.
Environment:
- Codex Desktop: 26.602.4764.0
- codex-cli: 0.137.0-alpha.4
- Windows 11 Pro Insider Preview 26200.8524
- Sandbox mode: elevated
Diagnostics already performed:
- Windows Sandbox launches successfully.
- Containers-DisposableClientVM feature is enabled.
- vmcompute and hns services are running.
- hypervisorlaunchtype is set to Auto.
- CodexSandboxOffline and CodexSandboxOnline users exist and are enabled.
- Bundled helper binaries are present.
- Computer Use plugin is installed.
- Plugin caches were removed and regenerated.
- Commands execute correctly outside the sandbox via escalation.
What is the expected behavior?
Commands should execute normally inside the Windows sandbox.
For example:
git status
should start successfully and return repository status instead of failing before process creation.
Additional information
Impact: sandbox execution is completely unusable.
Every command fails regardless of command content.
This appears to be a failure during sandbox process creation rather than a failure of the executed command itself.
I would like to know whether this is a known issue in Codex Desktop 26.602.x / codex-cli 0.137.0-alpha.4 on Windows, or whether additional Windows configuration is required for CreateProcessAsUserW to succeed.
6 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Additional information:
Get-Command pwsh -All returns:
C:\Program Files\WindowsApps\Microsoft.PowerShell_7.6.2.0_x64__8wekyb3d8bbwe\pwsh.exe
C:\Users\shend\AppData\Local\Microsoft\WindowsApps\pwsh.exe
PowerShell 7 is installed via WindowsApps/MSIX rather than MSI.
Windows PowerShell 5.1 is available at:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
This may be related to issue #25436 where reinstalling PowerShell via MSI resolved the same CreateProcessAsUserW failed: 5 error.
Update: I found a workaround.
The issue was caused by the Microsoft Store / MSIX version of PowerShell 7.
Originally:
C:\Program Files\WindowsApps\Microsoft.PowerShell_7.6.2.0_x64__8wekyb3d8bbwe\pwsh.exe
I removed the Store package:
Get-AppxPackage Microsoft.PowerShell | Remove-AppxPackage
Then installed the MSI version of PowerShell 7.6.2, which installs to:
C:\Program Files\PowerShell\7\pwsh.exe
After that, Codex sandbox execution started working normally.
Previously failing commands now succeed:
This appears to match the behavior described in issue #25436.
i have posted the same issue here, no reply. https://github.com/openai/codex/issues/24291
I tried the workaround but for me it makes no difference
Adding a data point that isolates this as a version regression (0.145 → 0.146), reproducible and still present in 0.147.0.
Environment
[windows] sandbox = "unelevated"in config.tomlC:\Users\<user>\AppData\Local\Microsoft\WindowsApps\pwsh.exe)Repro
ok(works, repeatedly, today)windows sandbox failed: CreateProcessAsUserW failed: 5 (Access is denied.)windows sandbox failed: CreateProcessAsUserW failed: 5 | si_flags=256 | creation_flags=525312Same machine, same config.toml, same PowerShell install, nothing else changed between tests — only the codex version.
npm install -g @openai/codex@0.145.0immediately restores sandbox function; re-upgrading breaks it again. On 0.146 the sandbox log (~/.codex/.sandbox/sandbox.*.log) shows every START with no SUCCESS, whereas pre-0.146 logs show START/SUCCESS pairs.Two observations that may help narrow it down
CreateProcessAsUserWfor the spawned process regardless of target executable, so it looks like the 0.146 sandbox architecture change (single codex.exe replacing .sandbox-bin) rather than the target binary's install type.codex execworkflows are fully blocked unless we pin 0.145.0.Happy to run diagnostics or a patched build if that would help.
Update: fixed in 0.148.0 — same machine as my 2026-08-10 comment above.
Repro is the same one-liner as before:
codex sandbox -- pwsh -c "echo ok"| codex-cli | MSIX pwsh (WindowsApps shim) | MSI pwsh (Program Files) |
|---|---|---|
| 0.145.0 | OK | not installed at the time |
| 0.146.0 |
CreateProcessAsUserW failed: 5| not installed at the time || 0.147.0 |
CreateProcessAsUserW failed: 5| not installed at the time || 0.148.0 | OK | OK |
Environment otherwise unchanged: Windows 11 Pro build 26200, Dell laptop, codex-cli installed via npm,
[windows] sandbox = "unelevated". That setting was already in place during the 0.146/0.147 failures, so it is not what fixed this.Two caveats so this isn't over-read:
pwshnow resolves toC:\Program Files\PowerShell\7\pwsh.exeinstead of the WindowsApps shim. That is a second changed variable, so to keep them separated I ran 0.148.0 against both builds by absolute path — both succeed. The MSIX install type is therefore not the discriminator here.Correction to my earlier comment. I previously offered the sandbox log as a diagnostic ("on 0.146 every START has no SUCCESS, whereas pre-0.146 logs show START/SUCCESS pairs"). Please don't rely on that signature. On 0.148.0 I have successful
codex sandboxinvocations — the command runs and prints its output — that log aSTART:line with no matchingSUCCESS:line, and one invocation that logged nothing at all. So START-without-SUCCESS does not by itself indicate a broken sandbox. The version-vs-version repro above is the reliable signal; the log is not.(For anyone looking: on this machine those entries are in
~/.codex/.sandbox/sandbox.<date>.log, a hidden directory — plainls ~/.codex/will not show it. The non-hidden~/.codex/sandbox.<date>.logis a different,AUDIT:-only log.)Sandbox denials still work on 0.148.0 — worth stating explicitly, since a fix to "sandbox won't start" could in principle have been a loosening. On 0.148.0 I confirmed all three of these are still blocked:
..relative-path escapes out of the workspaceVerified by checking the target paths myself afterwards rather than trusting the agent's self-report; the junction case in particular indicates the check is done on the resolved real path, not the literal path.
@Mahkhmood9 — re your question from June ("is this still relevant"): for this specific failure mode, not on 0.148.0.