openai/codex · error · anyhow::Error
GetNamedSecurityInfoW failed for
Error message
GetNamedSecurityInfoW failed for {}: {code} What it means
Fires in add_deny_ace when GetNamedSecurityInfoW fails while reading the DACL of the path that is about to receive a deny ACE (read or write deny for a SID). The error includes the path and the raw code; the function frees the security descriptor before returning.
Solutions
- Verify the path exists and is accessible with READ_CONTROL
- Inspect the code value (ERROR_ACCESS_DENIED, ERROR_FILE_NOT_FOUND, etc.)
- Ensure the sandbox setup runs with sufficient privileges to read security descriptors
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/windows-sandbox-rs/src/acl.rs:639 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/f753ed71d9a53588.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/windows-sandbox-rs/src/acl.rs:639
unsafe fn add_deny_ace(path: &Path, psid: *mut c_void, kind: DenyAceKind) -> Result<bool> {
let mut p_sd: *mut c_void = std::ptr::null_mut();
let mut p_dacl: *mut ACL = std::ptr::null_mut();
let code = GetNamedSecurityInfoW(
to_wide(path).as_ptr(),
1,
DACL_SECURITY_INFORMATION,
std::ptr::null_mut(),
std::ptr::null_mut(),
&mut p_dacl,
std::ptr::null_mut(),
&mut p_sd,
);
if code != ERROR_SUCCESS {
if !p_sd.is_null() {
LocalFree(p_sd as HLOCAL);
}
return Err(anyhow!(
"GetNamedSecurityInfoW failed for {}: {code}",
path.display()
));
}
let result = if kind.already_present(p_dacl, psid) {
Ok(false)
} else {
let trustee = TRUSTEE_W {
pMultipleTrustee: std::ptr::null_mut(),
MultipleTrusteeOperation: 0,
TrusteeForm: TRUSTEE_IS_SID,
TrusteeType: TRUSTEE_IS_UNKNOWN,
ptstrName: psid as *mut u16,
};
let mut explicit: EXPLICIT_ACCESS_W = std::mem::zeroed();
explicit.grfAccessPermissions = kind.mask();
explicit.grfAccessMode = DENY_ACCESS;
explicit.grfInheritance = CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE;View on GitHub (pinned to 339751715c)