{"record":{"id":"f1ca570a3727f2f9","repo":"openai/codex","slug":"helperusersgroupcreatefailed","errorCode":"HelperUsersGroupCreateFailed","errorMessage":"failed to create local group {name}, code {status}","messagePattern":"failed to create local group (.+?), code (.+?)","errorType":"error_code","errorClass":"SetupFailure","httpStatus":null,"severity":"error","filePath":"codex-rs/windows-sandbox-rs/src/bin/setup_main/win/sandbox_users.rs","lineNumber":188,"sourceCode":"    let comment_w = to_wide(OsStr::new(comment));\n    unsafe {\n        let info = LOCALGROUP_INFO_1 {\n            lgrpi1_name: name_w.as_ptr() as *mut u16,\n            lgrpi1_comment: comment_w.as_ptr() as *mut u16,\n        };\n        let mut parm_err: u32 = 0;\n        let status = NetLocalGroupAdd(\n            std::ptr::null(),\n            1,\n            &info as *const _ as *mut u8,\n            &mut parm_err as *mut _,\n        );\n        if status != NERR_Success && status != ERROR_ALIAS_EXISTS && status != NERR_GROUP_EXISTS {\n            super::log_line(\n                log,\n                &format!(\"NetLocalGroupAdd failed for {name} code {status} parm_err={parm_err}\"),\n            )?;\n            return Err(anyhow::Error::new(SetupFailure::new(\n                SetupErrorCode::HelperUsersGroupCreateFailed,\n                format!(\"failed to create local group {name}, code {status}\"),\n            )));\n        }\n    }\n    Ok(())\n}\n\npub fn ensure_local_group_member(group_name: &str, member_name: &str) -> Result<()> {\n    // If the member is already in the group, NetLocalGroupAddMembers may\n    // return an error code. We don't care.\n    let group_w = to_wide(OsStr::new(group_name));\n    let member_w = to_wide(OsStr::new(member_name));\n    unsafe {\n        let member = LOCALGROUP_MEMBERS_INFO_3 {\n            lgrmi3_domainandname: member_w.as_ptr() as *mut u16,\n        };\n        let _ = NetLocalGroupAddMembers(","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/bin/setup_main/win/sandbox_users.rs#L170-L206","documentation":"NetLocalGroupAdd returned a status other than NERR_Success, ERROR_ALIAS_EXISTS, or NERR_GROUP_EXISTS (the latter two are tolerated because the group already existing is fine). The sandbox local group could not be created, so subsequent steps that grant permissions to that group cannot proceed.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win/sandbox_users.rs:188 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Decode the status code in the message to identify the failure (access denied vs. system issue)","Run the setup elevated; creating local groups requires administrator privileges","If a stale group with the same name is in a bad state, delete it and re-run setup","Check the parm_err output logged alongside for the offending group-info field"],"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"}