Quick fix
# One-liner: change the owner to the current user (most common fix); add ACL if that fails
takeown /f <dir> /r /d y
Run in an admin PowerShell/Cmd; replace <dir> with the actual path from the error log.
What you will run into
Codex suddenly reports helper_unknown_error: setup refresh had errors while running shell commands; even with workspace_write permission, writing files under the project directory keeps failing;
after the failure the agent can only fall back to an escalated execution path (needs human approval).
New machines + directories copied from an old machine, cross-machine/cross-user shared directories, and WSL UNC paths trigger this most easily.
Why this happens
Codex runs a "setup refresh" at startup: it checks and fills write permissions (ACL/ACE) on the configured write roots; on failure the whole thing reports setup refresh had errors (shown as helper_unknown_error in the UI). Typical triggers:
| Trigger | Mechanism |
|---|---|
| Directory owner is another machine's / a deleted user's SID | Current user isn't the owner and can't modify the directory ACL -> ACE check fails |
| Folder copied directly from an old machine | Owner SID mismatch, same as above |
UNC/WSL path (\\wsl.localhost\...) | GetSecurityInfo fails (measured variant on this machine, error code 1) |
The startup setup refresh is an ACL/ACE permission self-check and write-back for the configured write roots: the client verifies the current user can write them, and any check failure surfaces as setup refresh had errors.
Windows ACLs record ownership by SID. If the directory owner is a SID from another machine or a deleted user, the current user is not the owner.
Such a user cannot modify the ACL even with read/write access, because modifying ACLs requires ownership or privilege. Folders copied from another machine are the classic source.
UNC/WSL paths (\wsl.localhost\...) failing at GetSecurityInfo are a separate chain (reproduced locally).
Deterministic takeaway: first separate "no permission" from "ACL not modifiable". icacls <dir> shows the owner and the effective ACL; for copied dirs, take ownership with takeown /f <dir> /r before changing ACLs.
For UNC/WSL write roots, use in-WSL paths (/root/...) instead of Windows-side paths.
Fixed diagnostic: an error at the permission-check stage plus a copied directory means a SID ownership problem — takeown first.
Step by step
1. Check the sandbox log to locate it — Diagnose
Faster than guessing: C:\Users\<user>\.codex\.sandbox\sandbox.<date>.log (old path C:\Users\<user>\.codex.sandbox\...). Search for setup refresh had errors / write ACE to see which path and what error.
2. Change the owner (most common fix) — Required
Command-line equivalent:
takeown /f <dir> /r /d y
Or in the GUI: Explorer -> directory Properties -> Security -> Advanced -> Change owner -> current user, ticking "Replace owner on subcontainers and objects".
3. Add ACL (when the owner is right but permissions are still missing) — Required
icacls <dir> /grant <user>:(OI)(CI)F /T
4. Verify recovery — Required
Open a new Codex session to trigger setup refresh; the log showing errors=[] means recovered - idempotent, no reinstall/reset needed.
How to confirm it works
The sandbox log shows the recovery marker (measured output shape):
sandbox.<date>.log
-> setup refresh completed with errors: [] (errors=[])
-> setup binary completed
Write operations to the project directory work normally in the Codex session; no more escalation approval needed.
Other environments
| Environment | Notes |
|---|---|
| Directory copied from an old machine | Owner SID mismatch; takeown to change the owner fixes it |
| UNC/WSL path | GetSecurityInfo failed ...: 1 (measured variant on this machine); same owner/ACL fix |
| Only write permission missing | icacls /grant <user>:(OI)(CI)F /T suffices |
| Recovery | Idempotent; the new session's setup refresh passes automatically, no reinstall |
| Not measured | Non-Windows platform behavior not measured |
Symptom
Codex reports helper_unknown_error: setup refresh had errors while running shell; even with workspace_write permission, writing files under the project directory keeps failing; afterwards the agent tries an escalated execution path (needs human approval) and only continues after approval. Common on new machines + directories copied from an old machine, cross-machine/cross-user shared directories, and WSL UNC paths.
Cause
Codex runs a "setup refresh" at startup: it checks and fills ACL/ACE write permissions on the configured write roots; on failure the whole thing reports setup refresh had errors (shown as helper_unknown_error). Typical triggers:
- The directory owner is another machine's / a deleted user's SID (folder copied directly from an old machine) - the current user isn't the owner and can't modify that directory's ACL -> ACE check fails;
GetSecurityInfofails on UNC/WSL paths (\\wsl.localhost\...) (measured variant on this machine, error code 1).
Solution
- Check the sandbox log first (faster than guessing):
C:\Users\<user>\.codex\.sandbox\sandbox.<date>.log(old pathC:\Users\<user>\.codex.sandbox\sandbox.<date>.log). Searchsetup refresh had errors/write ACEto see the exact path and error. - Change the owner (most common fix): Explorer -> directory Properties -> Security -> Advanced -> Change owner -> current user, ticking "Replace owner on subcontainers and objects"; command-line equivalent:
takeown /f <dir> /r /d y. - Add ACL (when the owner is right but permissions are still missing):
icacls <dir> /grant <user>:(OI)(CI)F /T. - Verify recovery: open a new Codex session to trigger setup refresh; the log showing
errors=[]means recovered - idempotent, no reinstall/reset needed.
Verification Evidence
- Local log reproduction (2026-08-29): this machine's
C:\Users\<user>\.codex\.sandbox\sandbox.<date>.logfully records the error chain:write ACE check failed on \\?\UNC\wsl.loc...(see the evidence log for details); fix path verified with takeown/icacls and a new session showingerrors=[].
Evidence details kept locally (2026-08-29)
Applicable tools (1)
This problem is linked from the tool pages below — reachable from either side.
codexSource & evidence
← Security & Governance domain | Problem Catalog Experience | Facing another issue? Go to the Helpdesk