openai/codex · error · anyhow::Error
SetEntriesInAclW failed for private desktop
Error message
SetEntriesInAclW failed for private desktop: {set_entries_code} What it means
SetEntriesInAclW returned a code other than ERROR_SUCCESS while building the DACL that grants the logon SID full access to the private desktop. The trustee entry is malformed or the SID invalid, so the desktop's restrictive ACL cannot be constructed; the code is also written to the debug log.
Solutions
- Decode the returned code: ERROR_INVALID_PARAMETER or ERROR_NONE_MAPPED points at an invalid logon SID trustee
- Ensure the logon SID buffer used for the TRUSTEE_W entry is a valid SID obtained from the process token
- Re-run the sandbox launch so a fresh logon SID and desktop are created
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/windows-sandbox-rs/src/desktop.rs:158 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/4cbe0e4296ee70e2.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/windows-sandbox-rs/src/desktop.rs:158
TrusteeForm: TRUSTEE_IS_SID,
TrusteeType: TRUSTEE_IS_UNKNOWN,
ptstrName: logon_sid.as_mut_ptr() as *mut c_void as *mut u16,
},
}];
let mut updated_dacl = ptr::null_mut();
let set_entries_code = SetEntriesInAclW(
entries.len() as u32,
entries.as_ptr(),
ptr::null_mut(),
&mut updated_dacl,
);
if set_entries_code != ERROR_SUCCESS {
logging::debug_log(
&format!("SetEntriesInAclW failed for private desktop: {set_entries_code}"),
logs_base_dir,
);
return Err(anyhow::anyhow!(
"SetEntriesInAclW failed for private desktop: {set_entries_code}"
));
}
let set_security_code = SetSecurityInfo(
handle,
SE_WINDOW_OBJECT,
DACL_SECURITY_INFORMATION,
ptr::null_mut(),
ptr::null_mut(),
updated_dacl,
ptr::null_mut(),
);
if !updated_dacl.is_null() {
LocalFree(updated_dacl as HLOCAL);
}
if set_security_code != ERROR_SUCCESS {
logging::debug_log(View on GitHub (pinned to 339751715c)