{"record":{"id":"2fed8b7ae8866494","repo":"openai/codex","slug":"getlengthsid-failed-for-sid-str","errorCode":null,"errorMessage":"GetLengthSid failed for {sid_str}","messagePattern":"GetLengthSid 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":280,"sourceCode":"        _ => 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}\"));\n    }\n    Ok(out)\n}\n\nfn lookup_account_name_for_sid(sid_str: &str) -> Result<String> {\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}: {}\",","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/bin/setup_main/win/sandbox_users.rs#L262-L298","documentation":"Error \"GetLengthSid failed for {sid_str}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win/sandbox_users.rs:280 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"}