Windows: local runner cannot start, CreateProcessAsUserW failed: 5
What version of the Codex App are you using (From “About Codex” dialog)?
26.527.31326
What subscription do you have?
pro
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x6
What issue are you seeing?
Bug: Codex Desktop on Windows cannot launch local runner: CreateProcessAsUserW failed: 5
Summary
Codex Desktop cannot execute any local workspace command on Windows. The workspace folder is readable from PowerShell outside Codex, but Codex tool execution fails before the command starts with:
windows sandbox: runner error: CreateProcessAsUserW failed: 5
Environment
- OS: Windows
- App: Codex Desktop
- Workspace path:
D:\temp\temp\Codex - Shell: PowerShell 7.6.2 installed via MSI
- Controlled Folder Access: Off
- Workspace sandbox mode shown in thread:
workspace-write - Writable root shown in thread:
D:\temp\temp\Codex
Reproduction
- Open Codex Desktop on Windows.
- Open workspace:
D:\temp\temp\Codex - Ask Codex to read/list the folder.
- Codex attempts to run:
```powershell
Get-ChildItem -Force -LiteralPath 'D:\temp\temp\Codex'
What steps can reproduce the bug?
Environment
- OS: Windows
- App: Codex Desktop
- Workspace path:
D:\temp\temp\Codex - Shell: PowerShell 7.6.2 installed via MSI
- Controlled Folder Access: Off
- Workspace sandbox mode shown in thread:
workspace-write - Writable root shown in thread:
D:\temp\temp\Codex
Reproduction
- Open Codex Desktop on Windows.
- Open workspace:
D:\temp\temp\Codex - Ask Codex to read/list the folder.
- Codex attempts to run:
```powershell
Get-ChildItem -Force -LiteralPath 'D:\temp\temp\Codex'
What is the expected behavior?
Codex should be able to launch its local helper/runner and read files inside the configured workspace.
Actual BehaviorCodex fails to spawn the local runner:
Add to chat
execution error: Io(Custom { kind: Other, error: "windows sandbox: runner error: CreateProcessAsUserW failed: 5" })
The Node REPL helper also failed with a sandbox/process launch error:
Add to chat
node_repl kernel exited unexpectedly
windows sandbox failed: spawn setup refresh
Additional information
Verification Outside CodexThe same folder is readable from an external PowerShell session:
powershell
Get-ChildItem -Force 'D:\temp\temp\Codex'
Output shows files successfully, including:
Add to chat
PIMCO_PIMS_Income_Fund_A_TSR_AR.pdf
PIMCO_PIMS_Income_Fund_A_TSR_SAR.pdf
PIMCO_PIMS_Income_Fund_FSTM_AR.pdf
PIMCO_PIMS_Income_Fund_FSTM_SAR.pdf
Troubleshooting Already TriedConfirmed Controlled Folder Access is off.
Confirmed folder is readable outside Codex.
Tried explicit Codex file permission grant for D:\temp\temp\Codex.
Retried command after permission grant; same error.
PowerShell is MSI-installed, not Store-installed.
NotesThis appears to be a Codex Desktop Windows runner/session-token issue rather than a workspace ACL or shell issue, because both PowerShell command execution and Node helper startup fail before accessing files.
12 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I ran into a similar
CreateProcessAsUserW failed: 5issue. In my case, the problem was not the target file permission or the command itself. The failure happened earlier: the Codex/Windows sandbox failed to create the PowerShell child process.This started after I changed the default shell from Windows PowerShell 5 to PowerShell 7. The issue disappeared after I switched PowerShell 7 to the standard MSI installation and made sure Codex was using the real
pwsh.exepath, not a WindowsApps alias or MSIX path.Useful check:
One important detail: avoid the Microsoft Store version of PowerShell 7, and avoid installing the MSIX package via winget. Those installations usually resolve to WindowsApps-related paths, for example:
or the corresponding WindowsApps package path. Such paths may not be launchable by
CreateProcessAsUserWunder a restricted sandbox token.A simple workaround is to download the
.msiinstaller from the PowerShell GitHub Releases page. The MSI installer lets you choose the installation directory, and its default path is usually:My understanding is that the sandbox uses
CreateProcessAsUserWto spawn the shell process. Some PowerShell 7 MSIX / Store / WindowsApps installations may be rejected by Windows under the restricted token, which results in:Additional note: after running
conda initin PowerShell 7, I also hit a separate issue:This is not the same root cause as
CreateProcessAsUserW failed: 5. It is caused by a compatibility issue between PowerShell 7 native command argument passing and the older conda PowerShell initialization script. A workaround is to add this before the conda initialization block in the PowerShell profile:The longer-term fix is to update conda and regenerate the PowerShell initialization:
yes the issue resolved after I uninstalled PowerShell and reinstalled from the .msi . The prior install was in a nonstandard location.
One thing that would make this much easier to diagnose is separating "command failed" from "runner never started."
In threads like this, people naturally go chase file ACLs, workspace permissions, or the exact shell command, but
CreateProcessAsUserW failed: 5means the failure happened before any of that mattered.A better product response would be something like:
That would stop a lot of false debugging.
Also feels worth logging a structured fingerprint for this error family so Codex can stop retrying the same launch path over and over once it knows the runner is dead. When local execution is unavailable, the fastest path is usually a crisp fail, not another hopeful spawn attempt.
@Keesan12, please stop posting bot-generated slop to our issue tracker. It's not useful, and it's creating noise for maintainers and users. If you do not stop, I'll ask GitHub to block your account.
This resolved the issue ``
windows sandbox: runner error: CreateProcessAsUserW failed: 5`` for me. Thanks!Love you babe. Problem perfectly solved.
I can reproduce this on native Windows Codex Desktop after updating and fully reopening the app (2026-07-22).
A fresh, normal sandboxed read-only probe fails before PowerShell begins:
The attempted child is the user-local
Microsoft\WindowsApps\pwsh.exe;Get-Locationnever starts. The same pre-launch failure has affected multiple fresh tasks and a minimal read-only probe, so it does not appear specific to the repository, Git worktrees, or an individual command.The recent Windows sandbox work in #34423 / 0.145.0 was a strong candidate, but the update did not resolve this particular error on this machine. No credentials, protected data, or project contents are involved.
I can reproduce this on native Windows Codex Desktop after updating and fully reopening the app (2026-07-22).
A fresh, normal sandboxed read-only probe fails before PowerShell begins:
windows sandbox: runner failed during SpawnChild: CreateProcessAsUserW failed: 5 (Access is denied.)
The attempted child is the user-local Microsoft\\WindowsApps\\pwsh.exe; Get-Location never starts. The same pre-launch failure has affected multiple fresh tasks and a minimal read-only probe, so it does not appear specific to the repository, Git worktrees, or an individual command.
The recent Windows sandbox work in #34423 / 0.145.0 was a strong candidate, but the update did not resolve this particular error on this machine. No credentials, protected data, or project contents are involved.
I can reproduce this same failure in Codex Desktop's managed
workspace-writerestricted runner on Windows 11.Additional bounded diagnosis
019f0576-bd6b-7572-88be-6e79e6915ec0.SpawnChild / CreateProcessAsUserW.5 (Access is denied).C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\pwsh.exe.Microsoft.PowerShellStore package (package statusOk; manifest declares thepwsh.exealias).C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exealso starts successfully outside the restricted boundary.This strongly isolates the failure to the Codex restricted child-process/token boundary rather than a broken PowerShell package, alias registration, filesystem ACL, AppLocker rule, or repository.
A useful product correction would be for the Windows-native runner to launch the registered alias correctly under its restricted token, use system PowerShell directly, or expose a supported explicit shell-executable setting. The current workaround is one approved retry through the full system Windows PowerShell path.
No Windows ACL, alias, package, PATH, registry, sandbox-policy, or security setting was changed during diagnosis. Codex app version was not available from the bounded process metadata.
Companion app-server path fails, but direct CLI sandbox succeeds
C:\<REDACTED>\...When Claude Code delegates a task through Codex Companion, the task fails while spawning the sandbox child process:
``
text
``CreateProcessAsUserW failed: -1073283067
0xC0070005
Win32 error 5: Access is denied
This persists after a full Windows reboot.
However, the same machine, account, workspace, and read-only sandbox succeed with direct Codex CLI:
cd C:\<REDACTED>\repository
codex exec --sandbox read-only "Reply exactly READY."
Result:
codex
READY
So the failure appears limited to the Claude Code Codex Companion / app-server delegation path, rather than Codex CLI
authentication, workspace access, or the read-only sandbox itself.
Expected behavior: Codex Companion should be able to launch the same read-only sandbox task that succeeds via direct
CLI.