{"record":{"id":"9144ea2df7071b22","repo":"openai/codex","slug":"helperfirewallpolicyaccessfailed","errorCode":"HelperFirewallPolicyAccessFailed","errorMessage":"CoCreateInstance NetFwPolicy2 failed: {err:?}","messagePattern":"CoCreateInstance NetFwPolicy2 failed: (.+?)","errorType":"error_code","errorClass":"SetupFailure","httpStatus":null,"severity":"error","filePath":"codex-rs/windows-sandbox-rs/src/bin/setup_main/win/firewall.rs","lineNumber":75,"sourceCode":"    proxy_ports: &[u16],\n    allow_local_binding: bool,\n    log: &mut dyn Write,\n) -> Result<()> {\n    let local_user_spec = format!(\"O:LSD:(A;;CC;;;{offline_sid})\");\n\n    let hr = unsafe { CoInitializeEx(None, COINIT_APARTMENTTHREADED) };\n    if hr.is_err() {\n        return Err(anyhow::Error::new(SetupFailure::new(\n            SetupErrorCode::HelperFirewallComInitFailed,\n            format!(\"CoInitializeEx failed: {hr:?}\"),\n        )));\n    }\n\n    let result = unsafe {\n        (|| -> Result<()> {\n            let policy: INetFwPolicy2 = CoCreateInstance(&NetFwPolicy2, None, CLSCTX_INPROC_SERVER)\n                .map_err(|err| {\n                    anyhow::Error::new(SetupFailure::new(\n                        SetupErrorCode::HelperFirewallPolicyAccessFailed,\n                        format!(\"CoCreateInstance NetFwPolicy2 failed: {err:?}\"),\n                    ))\n                })?;\n            ensure_local_policy_rules_take_effect(&policy)?;\n            let rules = policy.Rules().map_err(|err| {\n                anyhow::Error::new(SetupFailure::new(\n                    SetupErrorCode::HelperFirewallPolicyAccessFailed,\n                    format!(\"INetFwPolicy2::Rules failed: {err:?}\"),\n                ))\n            })?;\n\n            if allow_local_binding {\n                // Remove the legacy overlapping allow rule before returning to the local-binding\n                // mode so stale proxy exceptions do not linger.\n                remove_rule_if_present(&rules, OFFLINE_PROXY_ALLOW_RULE_NAME, log)?;\n                remove_rule_if_present(&rules, OFFLINE_BLOCK_LOOPBACK_UDP_RULE_NAME, log)?;\n                remove_rule_if_present(&rules, OFFLINE_BLOCK_LOOPBACK_TCP_RULE_NAME, log)?;","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/bin/setup_main/win/firewall.rs#L57-L93","documentation":"Error \"CoCreateInstance NetFwPolicy2 failed: {err:?}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win/firewall.rs:75 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"}