{"record":{"id":"c2899dc16c9524f8","repo":"openai/codex","slug":"convertstringsidtosidw-failed","errorCode":null,"errorMessage":"ConvertStringSidToSidW failed: {}","messagePattern":"ConvertStringSidToSidW failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/windows-sandbox-rs/src/bin/setup_main/win/sandbox_users.rs","lineNumber":358,"sourceCode":"    unsafe {\n        LocalFree(psid as _);\n    }\n    if ok == 0 {\n        return Err(anyhow::anyhow!(\n            \"LookupAccountSidW failed for {sid_str}: {}\",\n            unsafe { GetLastError() }\n        ));\n    }\n    let name = String::from_utf16_lossy(&name_buf);\n    Ok(name.trim_end_matches('\\0').to_string())\n}\n\npub fn sid_bytes_to_psid(sid: &[u8]) -> Result<*mut c_void> {\n    let sid_str = string_from_sid_bytes(sid).map_err(anyhow::Error::msg)?;\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: {}\",\n            unsafe { GetLastError() }\n        ));\n    }\n    Ok(psid)\n}\n\nfn random_password() -> String {\n    const CHARS: &[u8] =\n        b\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_=+\";\n    let mut rng = SmallRng::from_entropy();\n    let mut buf = [0u8; 24];\n    rng.fill_bytes(&mut buf);\n    buf.iter()\n        .map(|b| {\n            let idx = (*b as usize) % CHARS.len();\n            CHARS[idx] as char\n        })","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/bin/setup_main/win/sandbox_users.rs#L340-L376","documentation":"Error \"ConvertStringSidToSidW failed: {}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win/sandbox_users.rs:358 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"}