{"record":{"id":"ef71408b96ff9207","repo":"openai/codex","slug":"settokeninformation-tokendefaultdacl-failed-err","errorCode":null,"errorMessage":"SetTokenInformation(TokenDefaultDacl) failed: {err}","messagePattern":"SetTokenInformation\\(TokenDefaultDacl\\) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/windows-sandbox-rs/src/token.rs","lineNumber":99,"sourceCode":"    );\n    if res != ERROR_SUCCESS {\n        return Err(anyhow!(\"SetEntriesInAclW failed: {res}\"));\n    }\n    let mut info = TokenDefaultDaclInfo {\n        default_dacl: p_new_dacl,\n    };\n    let ok = SetTokenInformation(\n        h_token,\n        TokenDefaultDacl,\n        &mut info as *mut _ as *mut c_void,\n        std::mem::size_of::<TokenDefaultDaclInfo>() as u32,\n    );\n    if ok == 0 {\n        let err = GetLastError();\n        if !p_new_dacl.is_null() {\n            LocalFree(p_new_dacl as HLOCAL);\n        }\n        return Err(anyhow!(\n            \"SetTokenInformation(TokenDefaultDacl) failed: {err}\",\n        ));\n    }\n    if !p_new_dacl.is_null() {\n        LocalFree(p_new_dacl as HLOCAL);\n    }\n    Ok(())\n}\n\npub unsafe fn world_sid() -> Result<Vec<u8>> {\n    let mut size: u32 = 0;\n    CreateWellKnownSid(\n        WIN_WORLD_SID,\n        std::ptr::null_mut(),\n        std::ptr::null_mut(),\n        &mut size,\n    );\n    let mut buf: Vec<u8> = vec![0u8; size as usize];","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/token.rs#L81-L117","documentation":"SetTokenInformation returned zero when applying the newly built DACL as the token's default DACL, so the restricted token could not adopt the capability-based ACL. The new DACL is freed and token creation fails.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/token.rs:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the Win32 error (often access denied when the token lacks TOKEN_ADJUST_DEFAULT)","Ensure the base token was opened with TOKEN_ADJUST_DEFAULT access","Retry token creation with a freshly duplicated base token"],"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"}