{"record":{"id":"41e5c8393c5c2740","repo":"openai/codex","slug":"convertstringsidtosidw-failed-for-sid-str","errorCode":null,"errorMessage":"ConvertStringSidToSidW failed for {sid_str}: {}","messagePattern":"ConvertStringSidToSidW failed for (.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/windows-sandbox-rs/src/bin/setup_main/win/sandbox_users.rs","lineNumber":270,"sourceCode":"    }\n}\n\nfn well_known_sid_str(name: &str) -> Option<&'static str> {\n    match name {\n        \"Administrators\" => Some(SID_ADMINISTRATORS),\n        \"Users\" => Some(SID_USERS),\n        \"Authenticated Users\" => Some(SID_AUTHENTICATED_USERS),\n        \"Everyone\" => Some(SID_EVERYONE),\n        \"SYSTEM\" => Some(SID_SYSTEM),\n        _ => None,\n    }\n}\n\nfn sid_bytes_from_string(sid_str: &str) -> Result<Vec<u8>> {\n    let sid_w = to_wide(OsStr::new(sid_str));\n    let mut psid: *mut c_void = std::ptr::null_mut();\n    if unsafe { ConvertStringSidToSidW(sid_w.as_ptr(), &mut psid) } == 0 {\n        return Err(anyhow::anyhow!(\n            \"ConvertStringSidToSidW failed for {sid_str}: {}\",\n            unsafe { GetLastError() }\n        ));\n    }\n    let sid_len = unsafe { GetLengthSid(psid) };\n    if sid_len == 0 {\n        unsafe {\n            LocalFree(psid as _);\n        }\n        return Err(anyhow::anyhow!(\"GetLengthSid failed for {sid_str}\"));\n    }\n    let mut out = vec![0u8; sid_len as usize];\n    let ok = unsafe { CopySid(sid_len, out.as_mut_ptr() as *mut c_void, psid) };\n    unsafe {\n        LocalFree(psid as _);\n    }\n    if ok == 0 {\n        return Err(anyhow::anyhow!(\"CopySid failed for {sid_str}\"));","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/bin/setup_main/win/sandbox_users.rs#L252-L288","documentation":"Error \"ConvertStringSidToSidW failed for {sid_str}: {}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win/sandbox_users.rs:270 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"}