openai/codex · error · anyhow::Error

SetSecurityInfo failed for private desktop

Error message

SetSecurityInfo failed for private desktop: {set_security_code}

What it means

SetSecurityInfo returned a nonzero code while applying the newly built DACL to the private desktop handle (SE_WINDOW_OBJECT). The desktop keeps its default security and cannot be restricted to the logon SID, so the launch aborts; the updated DACL is freed before the check and the code is also logged.

Solutions

  1. Decode the returned code to distinguish privilege issues (needs WRITE_DAC on the desktop object) from invalid-parameter issues
  2. Run the sandbox elevated so desktop security modification is permitted
  3. Re-run the launch so a fresh desktop is created and the ACL applied cleanly
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/windows-sandbox-rs/src/desktop.rs:180 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/7611652321a9b8d7. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/windows-sandbox-rs/src/desktop.rs:180

    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(
            &format!("SetSecurityInfo failed for private desktop: {set_security_code}"),
            logs_base_dir,
        );
        return Err(anyhow::anyhow!(
            "SetSecurityInfo failed for private desktop: {set_security_code}"
        ));
    }

    Ok(())
}

impl Drop for PrivateDesktop {
    fn drop(&mut self) {
        unsafe {
            if self.handle != 0 {
                let _ = CloseDesktop(self.handle);
            }
        }
    }
}

View on GitHub (pinned to 339751715c)