{"record":{"id":"08873c3452e4547a","repo":"zeroclaw-labs/zeroclaw","slug":"proxy-is-disabled-use-action-set-with-enabled-t","errorCode":null,"errorMessage":"Proxy is disabled. Use action 'set' with enabled=true first","messagePattern":"Proxy is disabled\\. Use action 'set' with enabled=true first","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"crates/zeroclaw-tools/src/proxy_config.rs","lineNumber":380,"sourceCode":"        Ok(ToolResult {\n            success: true,\n            output: serde_json::to_string_pretty(&json!({\n                \"message\": \"Proxy disabled\",\n                \"proxy\": Self::proxy_json(&cfg.proxy),\n                \"environment\": Self::env_snapshot(),\n            }))?\n            .into(),\n            error: None,\n        })\n    }\n\n    fn handle_apply_env(&self) -> anyhow::Result<ToolResult> {\n        let cfg = self.load_config_without_env()?;\n        let proxy = cfg.proxy.clone();\n        proxy.validate()?;\n\n        if !proxy.enabled {\n            anyhow::bail!(\"Proxy is disabled. Use action 'set' with enabled=true first\");\n        }\n\n        if proxy.scope != ProxyScope::Environment {\n            anyhow::bail!(\n                \"apply_env only works when proxy.scope is 'environment' (current: {:?})\",\n                proxy.scope\n            );\n        }\n\n        proxy.apply_to_process_env();\n        set_runtime_proxy_config(proxy.clone());\n        let warnings = Self::dns_pinned_tool_warnings(&cfg);\n\n        Ok(ToolResult {\n            success: true,\n            output: serde_json::to_string_pretty(&json!({\n                \"message\": \"Proxy environment variables applied\",\n                \"proxy\": Self::proxy_json(&proxy),","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-tools/src/proxy_config.rs#L362-L398","documentation":"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.","triggerScenarios":"Invoking {\"action\":\"apply_env\"} on a fresh config where proxy.enabled defaults to false, or right after an explicit {\"action\":\"disable\"}.","commonSituations":"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.","solutions":["First run {\"action\":\"set\"} with the proxy block including \"enabled\":true, then re-run apply_env","Run {\"action\":\"get\"} to confirm current enabled state before applying","If disabling was intentional, remove the apply_env step from the workflow"],"exampleFix":"// before\n{\"action\":\"apply_env\"}  // bails: proxy disabled\n// after\n{\"action\":\"set\",\"proxy\":{\"enabled\":true,\"url\":\"http://127.0.0.1:7890\",\"scope\":\"environment\"}}\n{\"action\":\"apply_env\"}","handlingStrategy":"validation","validationCode":"// Check state before applying\nlet cfg = proxy_tool.execute(json!({\"action\":\"get\"})).await?;\nlet enabled = cfg.output[\"proxy\"][\"enabled\"].as_bool().unwrap_or(false);\nif enabled { proxy_tool.execute(json!({\"action\":\"apply_env\"})).await?; }","typeGuard":"fn proxy_is_enabled(cfg: &serde_json::Value) -> bool {\n    cfg.pointer(\"/proxy/enabled\").and_then(|v| v.as_bool()).unwrap_or(false)\n}","tryCatchPattern":"Err(e) if e.to_string().contains(\"Proxy is disabled\") => {\n    // run set with enabled=true, then re-invoke apply_env exactly once\n}","preventionTips":["Order scripts as set-then-apply; never assume defaults enable the proxy","Surface proxy state in startup diagnostics so a disabled proxy is visible","Treat disable as an explicit operator action and require re-enabling in the same change"],"tags":["proxy","config","state","precondition"],"backgroundTag":"feature-not-enabled","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}