Error text / 报错原文
SetNamedSecurityInfoW failed: 5grant read ACE failedread ACL run had errorshelper_unknown_errorsetup refresh had errors
What it means
SetNamedSecurityInfoW is the Windows API Codex reached while changing security information for a named object. Error 5 is ERROR_ACCESS_DENIED. The complete log line matters because it contains the object: a protected WindowsApps package, ordinary workspace, drive root, temp directory, or WSL UNC path requires a different response.
Intent boundary: if the error says CreateProcessWithLogonW or CreateProcessAsUserW, the failure occurred later while starting a sandboxed process. Use the linked process-launch guide instead.
Decision path: locate the failed ACL before changing permissions
1. Match the exact function
SetNamedSecurityInfoW means ACL setup failed. Do not collapse it into every other Windows error 5.
2. Find the named object
Read the full grant read ACE failed on … line in CODEX_HOME/.sandbox/sandbox.log. If it names WindowsApps\OpenAI.Codex_…\app or app\resources, the app’s packaged resources are the blocked ACL target.
3. Use the documented recovery order
Restart Codex, retry elevated sandbox setup with the expected administrator prompt, and use the unelevated sandbox as the documented fallback if protected package ACLs or enterprise policy still block setup.
4. Verify without broadening the machine
Run a harmless location command, list a user-owned test repository, and make one tiny Git-backed edit. Confirm the sandbox log does not record a new setup error.
Most common causes
- The elevated sandbox setup cannot grant its sandbox group read access to the packaged Codex app path under WindowsApps
- A Codex app update changed the packaged resource path while setup state still references a protected or stale location
- The failing object is a protected workspace, drive root, temp directory, or WSL UNC path rather than WindowsApps
- UAC approval, local user/group creation, firewall changes, logon rights, or enterprise policy blocked part of elevated sandbox setup
Fastest safe recovery
- Restart Codex, reproduce with a harmless command, then inspect
CODEX_HOME/.sandbox/sandbox.logandsetup_error.json. - If elevated setup is offered again, retry it and approve the administrator prompt when your environment allows it.
- If elevated setup still fails, set the documented temporary fallback in
%USERPROFILE%\.codex\config.tomland restart:
[windows] sandbox = "unelevated"
OpenAI describes unelevated as weaker than the preferred elevated sandbox, but still sandboxed. If your project and tools are already Linux-native, WSL2 is another documented route that avoids the native Windows sandbox.
Safe fix by target path
| Path in the failed log line | What it indicates | Next action |
|---|---|---|
C:\Program Files\WindowsApps\OpenAI.Codex_… | Packaged Codex app ACL setup | Update/restart, retry elevated setup, then use unelevated or WSL2 fallback. Do not rewrite WindowsApps ACLs. |
| User-owned project path | Workspace ownership or inherited ACL issue | Reproduce in a new Git-backed folder and inspect only the named tree. |
| Drive root or broad profile path | Workspace scope is too broad or protected | Open the specific repository instead of a drive or whole profile. |
| WSL UNC path | Native Windows agent is crossing filesystem/security models | Use a Windows-native project path or switch the agent itself to WSL2 and restart. |
What not to do
- Do not take ownership of or recursively rewrite ACLs on
C:\Program Files\WindowsApps - Do not grant Everyone or Users broad write access to Program Files, a drive root, your profile, or Codex package directories
- Do not delete
CODEX_HOMEbefore saving sandbox.log, setup_error.json, config.toml, and the exact app/package version - Do not assume running the UI as administrator permanently fixes the helper token or protected package path
- Do not use
/sandbox-add-read-diras a repair for Codex’s own WindowsApps package setup; that command is for session read access to an ordinary existing directory
How to collect a minimal diagnostic bundle
These commands read version and log metadata; they do not change ACLs:
Get-AppxPackage OpenAI.Codex | Select Name, Version, InstallLocation Get-ComputerInfo | Select WindowsProductName, WindowsVersion, OsBuildNumber Get-Content "$env:USERPROFILE\.codex\.sandbox\setup_error.json" -ErrorAction SilentlyContinue Get-ChildItem "$env:USERPROFILE\.codex\.sandbox" -Filter "sandbox*.log" -ErrorAction SilentlyContinue Select-String -Path "$env:USERPROFILE\.codex\.sandbox\sandbox*.log" ` -Pattern "SetNamedSecurityInfoW|grant read ACE|setup error" ` -Context 2,2 -ErrorAction SilentlyContinue
Before sharing logs, remove usernames, repository paths, tokens and other sensitive values. Never share CODEX_HOME/.sandbox-secrets/.
Why the visible symptom may look unrelated
OpenAI Codex issue reports show the same WindowsApps ACL signature underneath startup crashes, reconnect loops, apply_patch failures, child-process timeouts and Computer Use startup failures. Those reports are reproductions, not proof that every occurrence has one universal fix; the exact target path and sandbox mode remain decisive.
Frequently asked questions
Is this the same as CreateProcessWithLogonW failed: 5?
No. Both can return error 5, but this page owns ACL-update failures. The process-launch page owns CreateProcessWithLogonW and CreateProcessAsUserW.
Should I take ownership of WindowsApps?
No. WindowsApps uses protected package ACLs. Broad ownership or recursive ACL changes can damage Store apps and weaken system boundaries.
Can I switch to the unelevated sandbox?
Yes, when policy allows it. OpenAI documents it as a weaker fallback when elevated sandbox setup is blocked. Restart Codex after changing the setting.
What should I send with a bug report?
Include the package version, Windows version, sandbox mode, exact failed target path, setup_error.json message, sanitized sandbox.log excerpt, and whether unelevated sandbox or WSL2 works.
Related errors
- code=3221225477 - Codex Windows desktop crashes on launch →
- CreateProcessWithLogonW failed: 5 - Codex Windows sandbox →
- MCP auth session does not refresh - Codex OAuth →
- Codex desktop unresponsive with long threads and MCP auto-start duplicates →
- You've hit your session limit / weekly limit - Claude Code →
- Prompt is too long - Claude Code context window →
Related troubleshooting resources
Sources
- OpenAI Codex documentation: Windows sandbox modes and troubleshooting ↗
- OpenAI Codex issue #27889: elevated sandbox WindowsApps ACL failure ↗
- OpenAI Codex issue #17901: WindowsApps ACL failure ↗
- OpenAI Codex issue #15179: Store app sandbox ACL setup failure ↗
- OpenAI Codex issue #17612: reconnect and child-process timeout symptom ↗
- OpenAI Codex issue #25162: Computer Use blocked by sandbox ACL setup ↗
- Microsoft: SetNamedSecurityInfoW reference ↗
- Microsoft: Windows system error codes 0–499 ↗
Reviewed against current Codex Windows sandbox documentation and public issue evidence on July 31, 2026.