openai/codex · error · anyhow::Error

cannot update network.proxy_url on a running proxy

Error message

cannot update network.proxy_url on a running proxy

What it means

Guard in replace_config_state: the update attempts to change network.proxy_url while the proxy is running. The upstream proxy URL is captured when listener tasks start, so mutating it on a live proxy would leave old connections using the old upstream; the invariant is enforced with anyhow::ensure!.

Solutions

  1. Restart the proxy with the new proxy_url instead of hot-updating it
  2. Leave network.proxy_url unchanged when replacing config state on a running proxy
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

            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"
        );
        let settings = NetworkProxyRuntimeSettings::from_config(&new_state.config)?;
        self.state.replace_config_state(new_state).await?;
        let mut guard = self

View on GitHub (pinned to 339751715c)