openai/codex · error · anyhow::Error
SetEntriesInAclW sandbox dir failed
Error message
SetEntriesInAclW sandbox dir failed: {set} What it means
SetEntriesInAclW returned a nonzero Win32 error while building the new DACL from the sandbox directory ACE list. The ACL could not be constructed from the trustee entries (e.g. an invalid SID or malformed access mask), and the error code identifies which entry or parameter was rejected.
Solutions
- Decode the returned code: ERROR_INVALID_PARAMETER or ERROR_NONE_MAPPED typically points at a bad trustee SID in the entries list
- Re-resolve the sandbox group/user SIDs to ensure they are valid before re-running setup
- Free any partially built ACL with LocalFree on retry and confirm the trustee forms (TRUSTEE_IS_SID) match the supplied pointers
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win.rs:371 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/aa9874cf41c24787.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win.rs:371
grfInheritance: OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE,
Trustee: TRUSTEE_W {
pMultipleTrustee: std::ptr::null_mut(),
MultipleTrusteeOperation: 0,
TrusteeForm: TRUSTEE_IS_SID,
TrusteeType: TRUSTEE_IS_SID,
ptstrName: psid as *mut u16,
},
});
}
let mut new_dacl: *mut ACL = std::ptr::null_mut();
let set = SetEntriesInAclW(
eas.len() as u32,
eas.as_ptr(),
std::ptr::null_mut(),
&mut new_dacl,
);
if set != 0 {
return Err(anyhow::anyhow!(
"SetEntriesInAclW sandbox dir failed: {set}",
));
}
let (res, api) = match directory.as_ref() {
Some(directory) => (
SetSecurityInfo(
directory.as_raw_handle() as _,
SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION,
std::ptr::null_mut(),
std::ptr::null_mut(),
new_dacl,
std::ptr::null_mut(),
),
"SetSecurityInfo",
),
None => {
let path_w = to_wide(dir.as_os_str());View on GitHub (pinned to 339751715c)