{"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":"COM class instantiation for INetFwPolicy2 failed, so the firewall provisioning step cannot obtain the object used to read and modify Windows Firewall rules. CoInitializeEx succeeded, which means the failure is specific to creating the NetFwPolicy2 in-process server (e.g. the firewall service COM registration is broken or the class is not registered).","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":["Verify the Windows Firewall service (mpssvc) and its dependent services are running","Re-register the firewall COM classes by restoring default Windows Firewall configuration or running sfc /scannow for corrupted system components","Confirm the setup binary runs elevated so COM activation of firewall policy objects is permitted","Check the HRESULT from the debug output to identify whether the class is unregistered (REGDB_E_CLASSNOTREG) or activation was blocked"],"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"}