openai/codex · error · anyhow::Error
ConvertStringSidToSidW failed
Error message
ConvertStringSidToSidW failed: {} What it means
ConvertStringSidToSidW returned 0 while converting one of the ACE trustee SID strings (built from stored SID bytes) into PSIDs for the sandbox directory ACL entries. The reconstructed SID string for one of the trustees (SYSTEM, Administrators, real user, etc.) is unparseable, so the EXPLICIT_ACCESS_W list cannot be built.
Solutions
- Check the GetLastError code included in the message for the parse failure
- Identify which trustee SID was malformed and re-resolve it from its account name
- Re-run provisioning so all stored SID bytes are regenerated from valid accounts
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win.rs:344 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/b3739932e80a31d7.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win.rs:344
FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE | DELETE,
GRANT_ACCESS,
),
(
admins_sid,
FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE | DELETE,
GRANT_ACCESS,
),
(real_sid, real_user_mask, GRANT_ACCESS),
];
unsafe {
let mut eas: Vec<EXPLICIT_ACCESS_W> = Vec::new();
let mut sids: Vec<*mut c_void> = Vec::new();
for (sid_bytes, mask, access_mode) in entries.iter().map(|(s, m, a)| (s, *m, *a)) {
let sid_str = string_from_sid_bytes(sid_bytes).map_err(anyhow::Error::msg)?;
let sid_w = to_wide(OsStr::new(&sid_str));
let mut psid: *mut c_void = std::ptr::null_mut();
if ConvertStringSidToSidW(sid_w.as_ptr(), &mut psid) == 0 {
return Err(anyhow::anyhow!(
"ConvertStringSidToSidW failed: {}",
GetLastError()
));
}
sids.push(psid);
eas.push(EXPLICIT_ACCESS_W {
grfAccessPermissions: mask,
grfAccessMode: access_mode,
grfInheritance: OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE,
Trustee: TRUSTEE_W {
pMultipleTrustee: std::ptr::null_mut(),
MultipleTrusteeOperation: 0,
TrusteeForm: TRUSTEE_IS_SID,
TrusteeType: TRUSTEE_IS_SID,
ptstrName: psid as *mut u16,
},
});
}View on GitHub (pinned to 339751715c)