openai/codex · error · anyhow::Error

cannot update network.enabled on a running proxy

Error message

cannot update network.enabled on a running proxy

What it means

Guard in replace_config_state: a configuration update tried to change network.enabled while the proxy is already running. Enabling/disabling is a lifecycle operation (listeners must be started or torn down), so it cannot be swapped in-place on a live proxy; the enabled flag must match the current config.

Solutions

  1. Stop the running proxy before changing network.enabled, then restart it with the new setting
  2. Keep network.enabled unchanged in config updates applied to a running proxy
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/network-proxy/src/proxy.rs:1316 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/22ed147ca1cae8aa. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/network-proxy/src/proxy.rs:1316

            None
        };

        proxies.insert(
            environment_id,
            EnvironmentProxy {
                addrs,
                runtime: EnvironmentProxyRuntime::ListenerTasks {
                    http_task,
                    socks_task,
                },
            },
        );
        Ok(addrs)
    }

    pub async fn replace_config_state(&self, new_state: ConfigState) -> Result<()> {
        let current_cfg = self.state.current_cfg().await?;
        anyhow::ensure!(
            new_state.config.enabled == current_cfg.enabled,
            "cannot update network.enabled on a running proxy"
        );
        anyhow::ensure!(
            new_state.config.proxy_url == current_cfg.proxy_url,
            "cannot update network.proxy_url on a running proxy"
        );
        anyhow::ensure!(
            new_state.config.socks_url == current_cfg.socks_url,
            "cannot update network.socks_url on a running proxy"
        );
        anyhow::ensure!(
            new_state.config.enable_socks5 == current_cfg.enable_socks5,
            "cannot update network.enable_socks5 on a running proxy"
        );
        anyhow::ensure!(
            new_state.config.enable_socks5_udp == current_cfg.enable_socks5_udp,
            "cannot update network.enable_socks5_udp on a running proxy"

View on GitHub (pinned to 339751715c)