{"record":{"id":"4ad177e722bc8022","repo":"openai/codex","slug":"allocateandinitializesid-failed","errorCode":null,"errorMessage":"AllocateAndInitializeSid failed: {}","messagePattern":"AllocateAndInitializeSid failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/windows-sandbox-rs/src/setup.rs","lineNumber":504,"sourceCode":"\nfn is_elevated() -> Result<bool> {\n    unsafe {\n        let mut administrators_group: *mut c_void = std::ptr::null_mut();\n        let ok = AllocateAndInitializeSid(\n            &SECURITY_NT_AUTHORITY,\n            2,\n            SECURITY_BUILTIN_DOMAIN_RID,\n            DOMAIN_ALIAS_RID_ADMINS,\n            0,\n            0,\n            0,\n            0,\n            0,\n            0,\n            &mut administrators_group,\n        );\n        if ok == 0 {\n            return Err(anyhow!(\n                \"AllocateAndInitializeSid failed: {}\",\n                GetLastError()\n            ));\n        }\n        let mut is_member = 0i32;\n        let check = CheckTokenMembership(0, administrators_group, &mut is_member as *mut _);\n        FreeSid(administrators_group as *mut _);\n        if check == 0 {\n            return Err(anyhow!(\"CheckTokenMembership failed: {}\", GetLastError()));\n        }\n        Ok(is_member != 0)\n    }\n}\n\nfn canonical_existing(paths: &[PathBuf]) -> Vec<PathBuf> {\n    paths\n        .iter()\n        .filter_map(|p| {","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/setup.rs#L486-L522","documentation":"Error \"AllocateAndInitializeSid failed: {}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/setup.rs:504 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"}