{"record":{"id":"3bd1611ed030f13e","repo":"ruvnet/RuView","slug":"hap-was-requested-but-this-binary-was-built-withou","errorCode":null,"errorMessage":"HAP was requested but this binary was built without the `hap-server` feature","messagePattern":"HAP was requested but this binary was built without the `hap-server` feature","errorType":"console","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"v2/crates/homecore-server/src/hap.rs","lineNumber":59,"sourceCode":"        Ok(())\n    }\n}\n\npub(crate) async fn start(hc: &HomeCore, config: HapRuntimeConfig) -> Result<HapRuntime> {\n    let Some(bind_addr) = config.bind_addr else {\n        tracing::info!(\"HAP network server disabled\");\n        return Ok(HapRuntime {\n            #[cfg(feature = \"hap-server\")]\n            handle: None,\n            #[cfg(feature = \"hap-server\")]\n            state_task: None,\n        });\n    };\n\n    #[cfg(not(feature = \"hap-server\"))]\n    {\n        let _ = (hc, bind_addr);\n        anyhow::bail!(\n            \"HAP was requested but this binary was built without the `hap-server` feature\"\n        );\n    }\n\n    #[cfg(feature = \"hap-server\")]\n    {\n        use std::sync::Arc;\n\n        use homecore_hap::{\n            start_server, HapBridge, HapServerConfig, HapServiceRecord, MdnsSdAdvertiser,\n            PairingStore,\n        };\n\n        let device_id = config\n            .device_id\n            .as_deref()\n            .ok_or_else(|| anyhow::anyhow!(\"--hap-device-id is required when HAP is enabled\"))?;\n        let advertise_addr = config.advertise_addr.ok_or_else(|| {","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/v2/crates/homecore-server/src/hap.rs#L41-L77","documentation":"Anyhow bail in homecore-server's HAP startup: HAP was requested in the CLI config, but the binary was compiled without the `hap-server` cargo feature, so the code that would start the HomeKit bridge (start_server, MdnsSdAdvertiser, PairingStore from homecore_hap) does not exist in this build. When HAP is disabled the function returns a stub HapRuntime instead; this error fires only for the enabled-but-not-compiled combination.","triggerScenarios":"Running a binary built with default features while passing HAP-enabling flags (e.g. --hap-device-id); distro/CI artifacts commonly omit optional heavy features like hap-server; a Docker image built from a minimal feature set.","commonSituations":"Prebuilt release binaries that do not bundle hap-server; feature flags lost when reproducing a build (missing --features flag in CI or Dockerfile); copy-pasting a systemd unit that enables HAP onto a host with a non-HAP binary.","solutions":["Rebuild the server with the feature: cargo build --release --features hap-server (add it to your Dockerfile/CI invocation)","Or stop requesting HAP: remove/drop the --hap-* flags so the disabled-HAP path returns the stub runtime","Check the package's feature list (cargo metadata or docs) to confirm the exact feature name in your version","If you installed from a package manager, look for a variant package that includes HAP support"],"exampleFix":"# before\ncargo build --release\n# ./homecore-server --hap-enable ... -> HAP was requested but built without `hap-server`\n\n# after\ncargo build --release --features hap-server\n# ./homecore-server --hap-enable ... -> HAP bridge starts","handlingStrategy":"validation","validationCode":"# preflight: confirm the running binary was built with hap-server before enabling HAP\n# (cheap CLI probe; builds without the feature reject the HAP flags)\nif ! homecore-server --help 2>&1 | grep -q -- '--hap-device-id'; then\n  echo 'binary lacks hap-server feature; rebuild with --features hap-server' >&2\n  exit 1\nfi","typeGuard":null,"tryCatchPattern":"let hap = match hap::start(hc, hap_config).await {\n    Ok(runtime) => runtime,\n    Err(e) if e.to_string().contains('hap-server') => {\n        tracing::warn!(\"HAP unavailable in this build; continuing without it: {e}\");\n        HapRuntime::disabled()\n    }\n    Err(e) => return Err(e),\n};","preventionTips":["Encode required features once in the Dockerfile/CI build command and deploy that artifact everywhere","Smoke-test production binaries with the exact flags from your unit files before rollout","Keep optional-feature flags (hap-server, wasmtime, ruvector) in a single build matrix config"],"tags":["rust","cargo","feature-flags","hap","homekit","build-config"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}