{"record":{"id":"7458913d49010a9c","repo":"ruvnet/RuView","slug":"hap-advertise-addr-is-required-when-hap-is-enabl","errorCode":null,"errorMessage":"--hap-advertise-addr is required when HAP is enabled","messagePattern":"--hap-advertise-addr is required when HAP is enabled","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"v2/crates/homecore-server/src/hap.rs","lineNumber":78,"sourceCode":"            \"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(|| {\n            anyhow::anyhow!(\"--hap-advertise-addr is required when HAP is enabled\")\n        })?;\n        if let Some(parent) = config.pairing_store.parent() {\n            std::fs::create_dir_all(parent)?;\n        }\n\n        let advertiser = Arc::new(MdnsSdAdvertiser::new(\n            config.hostname.clone(),\n            advertise_addr,\n        )?);\n        let pairings = if config.pairing_store.exists() {\n            if config.setup_code.is_some() {\n                tracing::warn!(\n                    \"ignoring --hap-setup-code because the pairing store already exists\"\n                );\n            }\n            PairingStore::open(&config.pairing_store)?\n        } else {\n            let setup_code = config.setup_code.as_deref().ok_or_else(|| {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/v2/crates/homecore-server/src/hap.rs#L60-L96","documentation":"Anyhow error at HAP startup: HAP is enabled but --hap-advertise-addr was not provided. The address is required because MdnsSdAdvertiser is constructed with (hostname, advertise_addr) immediately after -- it is the IP HomeKit clients resolve via mDNS and connect to for pairing, and it cannot be guessed reliably on multi-interface machines.","triggerScenarios":"Enabling HAP without --hap-advertise-addr; expecting the server to auto-detect its LAN IP (it does not); Docker/NAT setups where the container IP differs from the host IP reachable by the iPhone.","commonSituations":"Multi-NIC hosts (VPN + LAN + docker bridges) making auto-detection ambiguous; containers needing the host's LAN address, not the bridge IP; first-time setup following a partial example command.","solutions":["Pass --hap-advertise-addr with the interface IP your HomeKit clients can reach (e.g. the host LAN IP, not 127.0.0.1)","In Docker, publish the HAP port and advertise the host's LAN address","On multi-NIC machines, verify reachability with ping/dig of the advertised mDNS hostname from the client device before pairing"],"exampleFix":"# before\n./homecore-server --hap-enable --hap-device-id $DID\n# error: --hap-advertise-addr is required when HAP is enabled\n\n# after\n./homecore-server --hap-enable --hap-device-id $DID --hap-advertise-addr 192.168.1.10","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\nLAN_IP=$(ip -4 -brief addr show scope global | awk '{print $3}' | cut -d/ -f1 | head -n1)\n: \"${LAN_IP:?could not determine advertise address}\"\nexec homecore-server --hap-enable --hap-advertise-addr \"$LAN_IP\" \"$@\"","typeGuard":"fn hap_config_valid(cfg: &HapConfig) -> bool {\n    cfg.enabled && cfg.advertise_addr.is_some()\n}","tryCatchPattern":null,"preventionTips":["Advertise the interface IP your HomeKit clients actually reach (usually the host LAN IP)","In containers, advertise the host IP and publish the HAP port, not the bridge IP","Verify with dig/ping of the advertised mDNS hostname from an iOS device before pairing"],"tags":["rust","cli","hap","homekit","mdns","networking"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}