{"record":{"id":"b3739932e80a31d7","repo":"openai/codex","slug":"convertstringsidtosidw-failed-b37399","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.rs","lineNumber":344,"sourceCode":"            FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE | DELETE,\n            GRANT_ACCESS,\n        ),\n        (\n            admins_sid,\n            FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE | DELETE,\n            GRANT_ACCESS,\n        ),\n        (real_sid, real_user_mask, GRANT_ACCESS),\n    ];\n    unsafe {\n        let mut eas: Vec<EXPLICIT_ACCESS_W> = Vec::new();\n        let mut sids: Vec<*mut c_void> = Vec::new();\n        for (sid_bytes, mask, access_mode) in entries.iter().map(|(s, m, a)| (s, *m, *a)) {\n            let sid_str = string_from_sid_bytes(sid_bytes).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 ConvertStringSidToSidW(sid_w.as_ptr(), &mut psid) == 0 {\n                return Err(anyhow::anyhow!(\n                    \"ConvertStringSidToSidW failed: {}\",\n                    GetLastError()\n                ));\n            }\n            sids.push(psid);\n            eas.push(EXPLICIT_ACCESS_W {\n                grfAccessPermissions: mask,\n                grfAccessMode: access_mode,\n                grfInheritance: OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE,\n                Trustee: TRUSTEE_W {\n                    pMultipleTrustee: std::ptr::null_mut(),\n                    MultipleTrusteeOperation: 0,\n                    TrusteeForm: TRUSTEE_IS_SID,\n                    TrusteeType: TRUSTEE_IS_SID,\n                    ptstrName: psid as *mut u16,\n                },\n            });\n        }","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/bin/setup_main/win.rs#L326-L362","documentation":"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.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win.rs:344 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}