{"record":{"id":"2593957e8475cb48","repo":"zeroclaw-labs/zeroclaw","slug":"gateway-feature-is-not-enabled-rebuild-with-fea","errorCode":null,"errorMessage":"Gateway feature is not enabled. Rebuild with --features gateway","messagePattern":"Gateway feature is not enabled\\. Rebuild with --features gateway","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":8149,"sourceCode":"            let restart_port = available_gateway_restart_hint_port(host, port);\n            anyhow::bail!(\n                \"{}\",\n                gateway_addr_in_use_message(host, port, &default_host, default_port, restart_port)\n            );\n        }\n        other => other,\n    }\n}\n\n#[cfg(not(feature = \"gateway\"))]\n#[allow(clippy::unused_async)]\nasync fn run_gateway_if_enabled(\n    _host: &str,\n    _port: u16,\n    _config: zeroclaw::config::Config,\n    _tx: Option<tokio::sync::broadcast::Sender<serde_json::Value>>,\n) -> anyhow::Result<()> {\n    anyhow::bail!(\"Gateway feature is not enabled. Rebuild with --features gateway\")\n}\n\nfn is_addr_in_use_error(err: &anyhow::Error) -> bool {\n    err.chain().any(|cause| {\n        cause\n            .downcast_ref::<std::io::Error>()\n            .is_some_and(|io| io.kind() == ErrorKind::AddrInUse)\n    })\n}\n\nfn is_default_gateway_addr(host: &str, port: u16, default_host: &str, default_port: u16) -> bool {\n    host == default_host && port == default_port\n}\n\nfn gateway_browser_host(host: &str) -> &str {\n    match host {\n        \"0.0.0.0\" => \"127.0.0.1\",\n        \"::\" | \"[::]\" => \"[::1]\",","sourceCodeStart":8131,"sourceCodeEnd":8167,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/src/main.rs#L8131-L8167","documentation":"The binary was compiled without the `gateway` cargo feature, so run_gateway_if_enabled is the stub variant (note the underscore-prefixed unused parameters in the SOURCE) that always bails. There is no runtime gateway implementation in this build to serve HTTP/WebSocket traffic.","triggerScenarios":"Invoking any command that reaches run_gateway_if_enabled (e.g. serving via the gateway) in a build produced without `--features gateway`. Typically a default `cargo build` or a distro package built with the minimal feature set.","commonSituations":"Installing a minimal/default-feature build then trying to use the web dashboard or gateway API; CI building with `--no-default-features`; downstream packagers trimming features to cut compile time.","solutions":["Rebuild with the gateway feature: `cargo build --release --features gateway`","Verify the feature actually reached the build (check the cargo command / feature list used by your install method)","If installed via a package manager, switch to a package/build that includes the gateway feature","Avoid `--no-default-features` unless you explicitly re-add the features you need"],"exampleFix":"# before\ncargo install zeroclaw\nzeroclaw serve   # -> Gateway feature is not enabled\n\n# after\ncargo install zeroclaw --features gateway\nzeroclaw serve","handlingStrategy":"validation","validationCode":"// Compile-time: gate your call site the same way the crate does.\n#[cfg(feature = \"gateway\")]\nasync fn serve() -> anyhow::Result<()> { run_gateway_if_enabled(...).await }\n#[cfg(not(feature = \"gateway\"))]\ncompile_error!(\"this binary needs `--features gateway`; rebuild with it enabled\");","typeGuard":"// Runtime feature detection for prebuilt binaries: probe for the gateway path\n// cheaply (e.g. `zeroclaw --help` output or a /healthz attempt) and treat\n// failure as 'feature missing' before invoking serve commands.","tryCatchPattern":null,"preventionTips":["Bake required features into your install command (cargo install zeroclaw --features gateway)","Record required features in the deployment docs and Dockerfile","Add a smoke test that starts the gateway in CI so a feature-stripped build fails the pipeline","Avoid --no-default-features unless you explicitly enumerate what you keep"],"tags":["build","feature-flag","gateway","compile-time"],"backgroundTag":"missing-compile-feature","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}