{"record":{"id":"27c42c13966615cb","repo":"openai/codex","slug":"getnamedsecurityinfow-failed-code","errorCode":null,"errorMessage":"GetNamedSecurityInfoW failed: {code}","messagePattern":"GetNamedSecurityInfoW failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/windows-sandbox-rs/src/acl.rs","lineNumber":535,"sourceCode":"/// Adds an allow ACE granting read/write/execute to the given SID on the target path.\n///\n/// # Safety\n/// Caller must ensure `psid` points to a valid SID and `path` refers to an existing file or directory.\npub unsafe fn add_allow_ace(path: &Path, psid: *mut c_void) -> Result<bool> {\n    let mut p_sd: *mut c_void = std::ptr::null_mut();\n    let mut p_dacl: *mut ACL = std::ptr::null_mut();\n    let code = GetNamedSecurityInfoW(\n        to_wide(path).as_ptr(),\n        1,\n        DACL_SECURITY_INFORMATION,\n        std::ptr::null_mut(),\n        std::ptr::null_mut(),\n        &mut p_dacl,\n        std::ptr::null_mut(),\n        &mut p_sd,\n    );\n    if code != ERROR_SUCCESS {\n        return Err(anyhow!(\"GetNamedSecurityInfoW failed: {code}\"));\n    }\n    // Already has write? Skip costly DACL rewrite.\n    if dacl_has_write_allow_for_sid(p_dacl, psid) {\n        if !p_sd.is_null() {\n            LocalFree(p_sd as HLOCAL);\n        }\n        return Ok(false);\n    }\n    let mut added = false;\n    // Always ensure write is present: if an allow ACE exists without write, add one with write+RX.\n    let trustee = TRUSTEE_W {\n        pMultipleTrustee: std::ptr::null_mut(),\n        MultipleTrusteeOperation: 0,\n        TrusteeForm: TRUSTEE_IS_SID,\n        TrusteeType: TRUSTEE_IS_UNKNOWN,\n        ptstrName: psid as *mut u16,\n    };\n    let mut explicit: EXPLICIT_ACCESS_W = std::mem::zeroed();","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/acl.rs#L517-L553","documentation":"Error \"GetNamedSecurityInfoW failed: {code}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/acl.rs:535 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}