openai/codex · error · anyhow::Error

failed to persist network policy amendment to execpolicy: {e

Error message

failed to persist network policy amendment to execpolicy: {err}

What it means

Error "failed to persist network policy amendment to execpolicy: {err}" thrown in openai/codex.

Source

Thrown at codex-rs/core/src/session/mod.rs:2322

            // Active enforcement changed successfully. Notify the owner before
            // the next fallible await so cancellation cannot contradict it.
            if let Some(on_policy_applied) = on_policy_applied.take() {
                on_policy_applied();
            }
        }

        self.services
            .exec_policy
            .append_network_rule_and_update(
                &codex_home,
                &host,
                execpolicy_amendment.protocol,
                execpolicy_amendment.decision,
                Some(execpolicy_amendment.justification),
            )
            .await
            .map_err(|err| {
                anyhow::anyhow!("failed to persist network policy amendment to execpolicy: {err}")
            })?;

        // Without a running proxy, persistence is the first effective policy change.
        if let Some(on_policy_applied) = on_policy_applied {
            on_policy_applied();
        }

        Ok(())
    }

    fn validated_network_policy_amendment_host(
        amendment: &NetworkPolicyAmendment,
        network_approval_context: &NetworkApprovalContext,
    ) -> anyhow::Result<String> {
        let approved_host = normalize_host(&network_approval_context.host);
        let amendment_host = normalize_host(&amendment.host);
        if amendment_host != approved_host {
            return Err(anyhow::anyhow!(

View on GitHub (pinned to 339751715c)

Solutions

  1. Check that the execpolicy file is writable and retry the policy amendment.

When it happens

Trigger: Thrown at codex-rs/core/src/session/mod.rs:2322 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/5dacd00aa89852cf. Report an issue: GitHub.