{"record":{"id":"11363753c0e6fd77","repo":"openai/codex","slug":"lookupaccountnamew-failed-for-name-err","errorCode":null,"errorMessage":"LookupAccountNameW failed for {name}: {err}","messagePattern":"LookupAccountNameW 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":249,"sourceCode":"                name_w.as_ptr(),\n                sid_buffer.as_mut_ptr() as *mut c_void,\n                &mut sid_len,\n                domain.as_mut_ptr(),\n                &mut domain_len,\n                &mut use_type,\n            )\n        };\n        if ok != 0 {\n            sid_buffer.truncate(sid_len as usize);\n            return Ok(sid_buffer);\n        }\n        let err = unsafe { GetLastError() };\n        if err == ERROR_INSUFFICIENT_BUFFER {\n            sid_buffer.resize(sid_len as usize, 0);\n            domain.resize(domain_len as usize, 0);\n            continue;\n        }\n        return Err(anyhow::anyhow!(\n            \"LookupAccountNameW failed for {name}: {err}\"\n        ));\n    }\n}\n\nfn well_known_sid_str(name: &str) -> Option<&'static str> {\n    match name {\n        \"Administrators\" => Some(SID_ADMINISTRATORS),\n        \"Users\" => Some(SID_USERS),\n        \"Authenticated Users\" => Some(SID_AUTHENTICATED_USERS),\n        \"Everyone\" => Some(SID_EVERYONE),\n        \"SYSTEM\" => Some(SID_SYSTEM),\n        _ => 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));","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/bin/setup_main/win/sandbox_users.rs#L231-L267","documentation":"LookupAccountNameW failed while resolving an account name (e.g. the sandbox group or user) to its SID, with a GetLastError other than ERROR_INSUFFICIENT_BUFFER (which the retry loop handles by resizing buffers). The account name could not be resolved to a SID at all — for example the account does not exist or the LSA lookup service failed — after the buffer-sizing iterations completed.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win/sandbox_users.rs:249 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the GetLastError code in the message: ERROR_NONE_MAPPED (1332) means the account name does not exist on this machine","If the name is a well-known account (Administrators, Users, Everyone, SYSTEM), let the code use its hardcoded SID string instead of a lookup","Repair the Local Security Authority service or domain trust if lookups fail system-wide","Recreate the missing sandbox user/group by re-running provisioning from scratch"],"exampleFix":null,"handlingStrategy":"retry","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"}