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

Fix Codex SetNamedSecurityInfoW Failed: 5 (WindowsApps ACL)

Codex reached the Windows sandbox permission-setup stage, attempted to change an ACL on a named path, and Windows returned error 5 (access denied). When the path is under WindowsApps, this concerns protected packaged app resources—not the permissions of your project command.

SetNamedSecurityInfoW failed 5 CodexCodex grant read ACE failedCodex WindowsApps ACL errorhelper_unknown_errorCodex sandbox.log Windows
Paste an error to match it against the wiki. / 粘贴报错后自动匹配。

Error text / 报错原文

  • SetNamedSecurityInfoW failed: 5
  • grant read ACE failed
  • read ACL run had errors
  • helper_unknown_error
  • setup 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

  1. Restart Codex, reproduce with a harmless command, then inspect CODEX_HOME/.sandbox/sandbox.log and setup_error.json.
  2. If elevated setup is offered again, retry it and approve the administrator prompt when your environment allows it.
  3. If elevated setup still fails, set the documented temporary fallback in %USERPROFILE%\.codex\config.toml and 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 lineWhat it indicatesNext action
C:\Program Files\WindowsApps\OpenAI.Codex_…Packaged Codex app ACL setupUpdate/restart, retry elevated setup, then use unelevated or WSL2 fallback. Do not rewrite WindowsApps ACLs.
User-owned project pathWorkspace ownership or inherited ACL issueReproduce in a new Git-backed folder and inspect only the named tree.
Drive root or broad profile pathWorkspace scope is too broad or protectedOpen the specific repository instead of a drive or whole profile.
WSL UNC pathNative Windows agent is crossing filesystem/security modelsUse 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_HOME before 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-dir as 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

Related troubleshooting resources

Sources

Reviewed against current Codex Windows sandbox documentation and public issue evidence on July 31, 2026.