openai/codex · error · std::io::Error

environment network policy violates managed requirements

Error message

environment network policy violates managed requirements: {error}

What it means

The environment-supplied network policy, after merging owner grants/denials and managed requirements, violates the managed constraints (e.g. allows domains the managed requirements deny). The constraint violation error is wrapped in this message and the environment cannot start with that policy.

Solutions

  1. Adjust the environment network policy to satisfy the managed requirements.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/core/src/config/network_proxy_spec.rs:243 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/ffc612548df9070b. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/core/src/config/network_proxy_spec.rs:243

            spec.constraints.allowlist_expansion_enabled = None;
        } else {
            spec.constraints.allowed_domains =
                Some(spec.config.allowed_domains().unwrap_or_default());
            spec.constraints.allowlist_expansion_enabled = Some(allow_owner_grants);
        }
        spec.constraints.denylist_expansion_enabled = Some(true);

        // Saved grants can extend a reviewable owner policy; owner denials are restored last.
        let (allowed_domains, denied_domains) = exec_policy.compiled_network_domains();
        if allow_owner_grants {
            upsert_network_domains(&mut spec.config, allowed_domains, /*allow*/ true);
        }
        upsert_network_domains(&mut spec.config, denied_domains, /*allow*/ false);
        upsert_network_domains(&mut spec.config, protected_denials, /*allow*/ false);
        spec.constraints.denied_domains = spec.config.denied_domains();

        validate_policy_against_constraints(&spec.config, &spec.constraints).map_err(|error| {
            std::io::Error::new(
                std::io::ErrorKind::InvalidInput,
                format!("environment network policy violates managed requirements: {error}"),
            )
        })?;
        Ok(spec)
    }

    pub(crate) fn with_exec_policy_network_rules(
        &self,
        exec_policy: &Policy,
    ) -> std::io::Result<Self> {
        let mut spec = self.clone();
        apply_exec_policy_network_rules(&mut spec.config, exec_policy);
        validate_policy_against_constraints(&spec.config, &spec.constraints).map_err(|err| {
            std::io::Error::new(
                std::io::ErrorKind::InvalidInput,
                format!("network proxy constraints are invalid: {err}"),
            )

View on GitHub (pinned to 339751715c)