openai/codex · error

guardian review session could not clear MCP servers

Error message

guardian review session could not clear MCP servers: {err}

What it means

Guardian review session setup failed while removing MCP servers from the cloned config — the config mutation returned an error, which is wrapped in this anyhow message. The guardian must run without MCP servers, so the failure aborts session creation.

Solutions

  1. Investigate why clearing MCP servers on the review session failed; see the reported error.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/core/src/guardian/review_session.rs:1422 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/01cc89b2dbdd347e. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/core/src/guardian/review_session.rs:1422

    ));
    guardian_config.base_instructions_provenance = Some(BaseInstructionsProvenance::Custom);
    guardian_config.notify = None;
    guardian_config.developer_instructions = None;
    guardian_config.permissions.approval_policy = Constrained::allow_only(AskForApproval::Never);
    let guardian_permission_profile =
        read_only_guardian_permission_profile(parent_config.permissions.permission_profile());
    guardian_config
        .permissions
        .set_permission_profile(guardian_permission_profile)
        .map_err(|err| {
            anyhow::anyhow!("guardian review session could not set permission profile: {err}")
        })?;
    guardian_config.include_apps_instructions = false;
    guardian_config
        .mcp_servers
        .set(HashMap::new())
        .map_err(|err| {
            anyhow::anyhow!("guardian review session could not clear MCP servers: {err}")
        })?;
    if let Some(live_network_config) = live_network_config
        && guardian_config.permissions.network.is_some()
    {
        let network_constraints = guardian_config
            .config_layer_stack
            .requirements()
            .network
            .as_ref()
            .map(|network| network.value.clone());
        guardian_config.permissions.network = Some(NetworkProxySpec::from_config_and_constraints(
            live_network_config,
            network_constraints,
            guardian_config.permissions.permission_profile(),
        )?);
    }
    for feature in [
        Feature::Collab,

View on GitHub (pinned to 339751715c)