You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows sandbox spawn fails with SetTokenInformation(TokenDefaultDacl) error 1344 when workdir is the home directory (and 1920 via per-user WindowsApps pwsh) #36328
CLIIssues related to the Codex CLIbugSomething isn't workingexecIssues related to the `codex exec` subcommandsandboxIssues related to permissions or sandboxingwindows-osIssues related to Codex on Windows systems
Reproduced on 0.144.0, 0.145.0, and 0.146.0 (identical behavior on all three).
Platform
Windows 11 Pro (10.0.22000), x64. codex exec (headless, approval: never).
What happened?
Any model-generated shell command fails before the child process starts:
windows sandbox: runner failed during SpawnChild: SetTokenInformation(TokenDefaultDacl) failed: 1344
Error 1344 is ERROR_ALLOTTED_SPACE_EXCEEDED — the default DACL being set does not fit the token's fixed dynamic buffer.
Root cause (isolated)
The failure is working-directory dependent, not version dependent:
Launching codex with the workdir set to the user's home directory (C:\Users\<user>), the sandbox setup enumerates ~147 write roots (setup refresh: processed 147 write roots in ~/.codex/.sandbox/sandbox.<date>.log). The DACL composed from that many roots exceeds the sandbox token's allotted space → 1344 on every spawn, both windows.sandbox = "elevated" and "unelevated".
Launching from a normal, narrower project directory, 1344 disappears.
A second, independent failure then surfaces:
windows sandbox: runner error: CreateProcessAsUserW failed: 1920 (The file cannot be accessed by the system.)
because codex resolves pwsh.exe from the per-user Store alias directory (C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\pwsh.exe), which the sandbox's separate user account cannot read by design. Removing WindowsApps from PATH for the codex process (so it falls back to a machine-wide shell) fixes it.
Interactive TUI sessions mask both failures: the sandbox error triggers an approval escalation and the command runs unsandboxed after user approval. Headless exec with approval: never has no escalation path and hard-fails.
Repro steps
On Windows, cd %USERPROFILE% (a home directory with a typical number of subdirectories).
echo "Run the shell command 'echo hello' and report its output." | codex exec -
Observe 1344 before the child starts. Repeat from a small project directory → 1344 gone; if pwsh resolves from per-user WindowsApps, observe 1920 instead.
Expected behavior
The sandbox should either cap/aggregate write-root ACEs so the token DACL fits (or fail with an actionable message naming the workdir breadth as the cause), and should not select a shell binary the sandbox user cannot access.
Workaround (verified)
Launch codex exec from a scoped project directory, never the home directory.
Strip per-user WindowsApps entries from PATH for the codex process.
With both applied, the sandbox works fully (verified with large multi-hour headless workloads).
Logs
~/.codex/.sandbox/sandbox.<date>.log shows the 147-write-root setup passes and repeated hide users: failed to hide current user profile dir ... 5 (Access is denied.) warnings preceding the spawn failures. Happy to attach full logs on request.
I tested the suggested workaround from #36328 by starting a new ChatGPT Work chat explicitly attached to a narrow project folder (C:\Users\aginf\pulse) instead of the user home directory.
The built-in browser still fails to initialize before opening a tab.
This indicates that, in the ChatGPT Work desktop app, the browser failure persists even with a scoped project directory and is not resolved by the CLI workaround in #36328.
~/.codex/cap_sid had grown to 14,912 bytes and contained capability SID mappings for a very large number of paths under the profile.
Both ordinary shell execution and the filesystem helper failed before starting the requested process.
Switching [windows] sandbox from elevated to unelevated did not resolve an already affected workspace-write session.
A direct read-only codex sandbox cmd.exe /d /c echo sandbox-ok invocation succeeded.
Resetting the generated cap_sid cache and using sandbox_mode = "read-only" avoids the failure.
A narrower project/workspace directory is required before returning to workspace-write; using the whole home directory recreates the large writable-root set.
This strongly matches the reported default-DACL size exhaustion. It would help if Codex rejected or aggregated overly broad home-directory writable roots before minting one capability SID/ACE per child path, and surfaced a specific diagnostic suggesting a narrower workspace.
250 write roots from a home-directory cwd (this report cites 147), plus the same warning:
hide users: failed to hide current user profile dir (C:\Users\Default): SetFileAttributesW failed for C:\Users\Default: 5 (Access is denied.)
Worth adding: the setup refresh uses the session cwd, not the per-command working directory. Setting the tool call's workdir to a narrow project subdirectory did not change it — every refresh still logged cwd=C:\Users\<user> and processed 250 write roots.
Nuance: failures are per-spawn and tool-path dependent, not "every command fails"
In the same session, same minute:
Operation
Sandbox path
Result
shell command (exec tool)
codex-command-runner.exe
OK — runs normally
apply_patch Add File
direct write
OK
apply_patch Update / Delete
codex.exe --codex-run-as-fs-helper
FAIL 1344
node_repl kernel spawn
cua_node node kernel
FAIL 1344
Both failing paths spawn an extra helper process; the shell path keeps working throughout. codex sandbox <cmd> (read-only) also works, consistent with the writable-DACL-buffer theory in this thread.
Ruled out
Runner version — the local runtime was refreshed from codex-command-runner-0.147.0-alpha.6.6.exe to the current 0.15x runner; symptom unchanged.
Desktop app build — the MSIX app is on the newest build its Store channel offers (its own log: [windows-store-updater] ... hasUpdate=false ... overallState=NoUpdates), and the newer CDN build is not installable on this device. The failure also reproduces without the app.
Resources / AV — 63.7 GB RAM (26.2 GB free), 158 GB free disk, no endpoint protection detected, codex doctor reports the sandbox/update config locally consistent.
Next
Re-testing from a scoped project directory to confirm the write-root count drops and the 1344 disappears on the fs-helper and node_repl paths.
Confirming on codex-cli 0.155.1, Windows 11 Pro 10.0.26220, [windows] sandbox = "elevated" and "unelevated" (both fail the same way).
Token-free repro, no model call needed:
cd %USERPROFILE%
codex sandbox -P :workspace cmd /c "echo ok" -> SetTokenInformation(TokenDefaultDacl) failed: 1344
codex sandbox -P :read-only cmd /c "echo ok" -> ok
cd <any project folder>
codex sandbox -P :workspace cmd /c "echo ok" -> ok
Two measurements that narrow it down:
It is the number of write roots, not the number of directory entries. A scratch folder holding 600 files and 300 subfolders runs fine under :workspace, because it is granted as a single root. With the profile root as cwd, each top-level child becomes its own write root with its own capability SID: CODEX_HOME/cap_sid holds 733 entries under writable_root_by_path here, and the profile root has 486 children.
set_default_dacl in windows-sandbox-rs/src/token.rs builds one EXPLICIT_ACCESS_W per capability SID and SetEntriesInAclW succeeds; it is the following SetTokenInformation(TokenDefaultDacl) that returns 1344, so the limit being hit is the token's dynamic quota for the default DACL, not the 64 KB ACL size.
Reducing the profile root from 724 to 486 entries did not help, so tidying the folder is not a practical workaround. Starting Codex in a project folder is.
Closing as a duplicate for the TokenDefaultDacl 1344 failure in #26438. The home-directory/large write-root-count repro and codex sandbox command here narrow when that bug happens and should remain part of #26438. Please track the separate WindowsApps pwsh 1920 problem with #35871; it is not caused by the DACL overflow.
CLIIssues related to the Codex CLIbugSomething isn't workingexecIssues related to the `codex exec` subcommandsandboxIssues related to permissions or sandboxingwindows-osIssues related to Codex on Windows systems
Activity
github-actions commentedon Jul 31, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
willribeiro09 commentedon Aug 9, 2026
I tested the suggested workaround from #36328 by starting a new ChatGPT Work chat explicitly attached to a narrow project folder (
C:\Users\aginf\pulse) instead of the user home directory.The built-in browser still fails to initialize before opening a tab.
This indicates that, in the ChatGPT Work desktop app, the browser failure persists even with a scoped project directory and is not resolved by the CLI workaround in #36328.
samiko121 commentedon Sep 7, 2026
I reproduced this on Windows 11 Pro (10.0.22631), Codex Desktop 26.901.6511.0, with codex-cli 0.153.4.
The failure was identical:
Local evidence:
C:\Users\SamiPC.~/.codex/.sandbox/sandbox.2026-09-07.logreportedsetup refresh: processed 135 write roots (read roots delegated); errors=[].~/.codex/cap_sidhad grown to 14,912 bytes and contained capability SID mappings for a very large number of paths under the profile.[windows] sandboxfromelevatedtounelevateddid not resolve an already affected workspace-write session.codex sandbox cmd.exe /d /c echo sandbox-okinvocation succeeded.cap_sidcache and usingsandbox_mode = "read-only"avoids the failure.workspace-write; using the whole home directory recreates the large writable-root set.This strongly matches the reported default-DACL size exhaustion. It would help if Codex rejected or aggregated overly broad home-directory writable roots before minting one capability SID/ACE per child path, and surfaced a specific diagnostic suggesting a narrower workspace.
superandylin commentedon Sep 10, 2026
Confirming this on a different machine, and adding a nuance to the "every command fails" framing.
Environment
codex-cli 0.154.0(npm install), Windows 11 Enterprise10.0.26200x64[windows] sandbox = "elevated";codex doctorreports✓ sandbox/restricted fs + restricted network,sandbox backend = elevated,sandbox provisioning = completeC:\Users\<user>)Write-root count is even higher here
~/.codex/.sandbox/sandbox.2026-09-10.log:250 write roots from a home-directory cwd (this report cites 147), plus the same warning:
Worth adding: the setup refresh uses the session cwd, not the per-command working directory. Setting the tool call's
workdirto a narrow project subdirectory did not change it — every refresh still loggedcwd=C:\Users\<user>andprocessed 250 write roots.Nuance: failures are per-spawn and tool-path dependent, not "every command fails"
In the same session, same minute:
codex-command-runner.exeapply_patchAdd Fileapply_patchUpdate / Deletecodex.exe --codex-run-as-fs-helpernode_replkernel spawncua_nodenode kernelBoth failing paths spawn an extra helper process; the shell path keeps working throughout.
codex sandbox <cmd>(read-only) also works, consistent with the writable-DACL-buffer theory in this thread.Ruled out
codex-command-runner-0.147.0-alpha.6.6.exeto the current 0.15x runner; symptom unchanged.[windows-store-updater] ... hasUpdate=false ... overallState=NoUpdates), and the newer CDN build is not installable on this device. The failure also reproduces without the app.codex doctorreports the sandbox/update config locally consistent.Next
Re-testing from a scoped project directory to confirm the write-root count drops and the 1344 disappears on the fs-helper and
node_replpaths.stanpoet commentedon Sep 21, 2026
Confirming on
codex-cli 0.155.1, Windows 11 Pro 10.0.26220,[windows] sandbox = "elevated"and"unelevated"(both fail the same way).Token-free repro, no model call needed:
Two measurements that narrow it down:
:workspace, because it is granted as a single root. With the profile root as cwd, each top-level child becomes its own write root with its own capability SID:CODEX_HOME/cap_sidholds 733 entries underwritable_root_by_pathhere, and the profile root has 486 children.set_default_daclinwindows-sandbox-rs/src/token.rsbuilds oneEXPLICIT_ACCESS_Wper capability SID andSetEntriesInAclWsucceeds; it is the followingSetTokenInformation(TokenDefaultDacl)that returns 1344, so the limit being hit is the token's dynamic quota for the default DACL, not the 64 KB ACL size.Reducing the profile root from 724 to 486 entries did not help, so tidying the folder is not a practical workaround. Starting Codex in a project folder is.
etraut-openai commentedon Oct 12, 2026
(response from codex)
Closing as a duplicate for the TokenDefaultDacl 1344 failure in #26438. The home-directory/large write-root-count repro and codex sandbox command here narrow when that bug happens and should remain part of #26438. Please track the separate WindowsApps pwsh 1920 problem with #35871; it is not caused by the DACL overflow.
SetTokenInformation(TokenDefaultDacl) failed: 1344(ERROR_ALLOTTED_SPACE_EXCEEDED) — every command fails before start in workspace-write, on both elevated and unelevated #26438