openai/codex · error · anyhow::Error

SetNamedSecurityInfoW failed

Error message

SetNamedSecurityInfoW failed: {code3}

What it means

Fires in ensure_allow_mask_aces_with_inheritance_impl when SetNamedSecurityInfoW returns a non-success code while writing the rebuilt DACL back to the target path, meaning the new allow-mask ACEs could not be persisted. The function frees the new DACL and security descriptor before returning this error.

Solutions

  1. Verify WRITE_DAC access on the target path for the current process
  2. Check the code3 value (ERROR_ACCESS_DENIED, ERROR_INVALID_PARAMETER, etc.) for the cause
  3. Ensure the rebuilt ACL structure is valid before assignment
  4. Run as part of an elevated setup step if privilege elevation is required
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/windows-sandbox-rs/src/acl.rs:449 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/ec6f9b4165640639. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/windows-sandbox-rs/src/acl.rs:449

                DACL_SECURITY_INFORMATION,
                std::ptr::null_mut(),
                std::ptr::null_mut(),
                p_new_dacl,
                std::ptr::null_mut(),
            );
            if code3 == ERROR_SUCCESS {
                added = true;
                if !p_new_dacl.is_null() {
                    LocalFree(p_new_dacl as HLOCAL);
                }
            } else {
                if !p_new_dacl.is_null() {
                    LocalFree(p_new_dacl as HLOCAL);
                }
                if !p_sd.is_null() {
                    LocalFree(p_sd as HLOCAL);
                }
                return Err(anyhow!("SetNamedSecurityInfoW failed: {code3}"));
            }
        } else {
            if !p_sd.is_null() {
                LocalFree(p_sd as HLOCAL);
            }
            return Err(anyhow!("SetEntriesInAclW failed: {code2}"));
        }
    }
    if !p_sd.is_null() {
        LocalFree(p_sd as HLOCAL);
    }
    Ok(added)
}

/// Ensure all provided SIDs have an allow ACE with the requested mask on the path.
/// Returns true if any ACE was added.
///
/// # Safety

View on GitHub (pinned to 339751715c)