zeroclaw-labs/zeroclaw · warning · anyhow::Error

Proxy is disabled. Use action 'set' with enabled=true first

Error message

Proxy is disabled. Use action 'set' with enabled=true first

What it means

The proxy_config tool's apply_env action exports the stored proxy settings into process environment variables (HTTP_PROXY/HTTPS_PROXY), but refuses when the stored proxy is not enabled. handle_apply_env loads the config, validates it, and bails with this guidance before touching the environment.

Source

Thrown at crates/zeroclaw-tools/src/proxy_config.rs:380

        Ok(ToolResult {
            success: true,
            output: serde_json::to_string_pretty(&json!({
                "message": "Proxy disabled",
                "proxy": Self::proxy_json(&cfg.proxy),
                "environment": Self::env_snapshot(),
            }))?
            .into(),
            error: None,
        })
    }

    fn handle_apply_env(&self) -> anyhow::Result<ToolResult> {
        let cfg = self.load_config_without_env()?;
        let proxy = cfg.proxy.clone();
        proxy.validate()?;

        if !proxy.enabled {
            anyhow::bail!("Proxy is disabled. Use action 'set' with enabled=true first");
        }

        if proxy.scope != ProxyScope::Environment {
            anyhow::bail!(
                "apply_env only works when proxy.scope is 'environment' (current: {:?})",
                proxy.scope
            );
        }

        proxy.apply_to_process_env();
        set_runtime_proxy_config(proxy.clone());
        let warnings = Self::dns_pinned_tool_warnings(&cfg);

        Ok(ToolResult {
            success: true,
            output: serde_json::to_string_pretty(&json!({
                "message": "Proxy environment variables applied",
                "proxy": Self::proxy_json(&proxy),

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. First run {"action":"set"} with the proxy block including "enabled":true, then re-run apply_env
  2. Run {"action":"get"} to confirm current enabled state before applying
  3. If disabling was intentional, remove the apply_env step from the workflow

Example fix

// before
{"action":"apply_env"}  // bails: proxy disabled
// after
{"action":"set","proxy":{"enabled":true,"url":"http://127.0.0.1:7890","scope":"environment"}}
{"action":"apply_env"}
Defensive patterns

Strategy: validation

Validate before calling

// Check state before applying
let cfg = proxy_tool.execute(json!({"action":"get"})).await?;
let enabled = cfg.output["proxy"]["enabled"].as_bool().unwrap_or(false);
if enabled { proxy_tool.execute(json!({"action":"apply_env"})).await?; }

Type guard

fn proxy_is_enabled(cfg: &serde_json::Value) -> bool {
    cfg.pointer("/proxy/enabled").and_then(|v| v.as_bool()).unwrap_or(false)
}

Try / catch

Err(e) if e.to_string().contains("Proxy is disabled") => {
    // run set with enabled=true, then re-invoke apply_env exactly once
}

Prevention

When it happens

Trigger: Invoking {"action":"apply_env"} on a fresh config where proxy.enabled defaults to false, or right after an explicit {"action":"disable"}.

Common situations: Fresh installs where the proxy block was never configured; orchestration scripts that call apply_env before set; re-enabling forgotten after a temporary disable during debugging.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/08873c3452e4547a. Report an issue: GitHub.