openai/codex · error

convert SID failed

Error message

convert SID failed

What it means

Sentinel error: converting a SID string to a PSID failed inside the worker thread that grants write-root access. Each grant thread converts the sandbox group SID and the root capability SID locally; the chained error names the conversion failure so the thread cannot build the trustees for SetEntriesInAcl.

Solutions

  1. Check the chained conversion error and its GetLastError code
  2. Verify the sandbox group SID and capability SID strings are well-formed S-1-... values
  3. Re-run setup so SID strings are regenerated from freshly resolved accounts
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win.rs:919 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/eb59d134d71f10af. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win.rs:919

                ),
            )?;
            grant_tasks.push((root.clone(), root_cap_sid_str));
        }
    }

    let (tx, rx) = mpsc::channel::<(PathBuf, Result<bool>)>();
    std::thread::scope(|scope| {
        for (root, root_cap_sid_str) in grant_tasks {
            let sid_strings = vec![sandbox_group_sid_str.clone(), root_cap_sid_str];
            let tx = tx.clone();
            scope.spawn(move || {
                // Convert SID strings to psids locally in this thread.
                let mut psids: Vec<*mut c_void> = Vec::new();
                for sid_str in &sid_strings {
                    if let Some(psid) = unsafe { convert_string_sid_to_sid(sid_str) } {
                        psids.push(psid);
                    } else {
                        let _ = tx.send((root.clone(), Err(anyhow::anyhow!("convert SID failed"))));
                        return;
                    }
                }

                let res = unsafe { ensure_allow_write_aces(&root, &psids) };

                for psid in psids {
                    unsafe {
                        LocalFree(psid as HLOCAL);
                    }
                }
                let _ = tx.send((root, res));
            });
        }
        drop(tx);
        for (root, res) in rx {
            match res {
                Ok(_) => {}

View on GitHub (pinned to 339751715c)