ducaale/xh · error

This binary was built without support for binding to…

Error message

This binary was built without support for binding to interfaces. Enable the `network-interface` feature.

What it means

This xh binary was compiled without the `network-interface` cargo feature, which provides the ability to bind outgoing requests to a specific network interface. When the user passes an interface-binding option, `run` immediately returns this error because the code path that would use the `network_interface` crate is compiled out. It is a build-time capability check, not a runtime failure.

Solutions

  1. Rebuild/reinstall xh with the feature enabled: `cargo install xh --features network-interface` (or with default features).
  2. Download an official pre-built xh release binary, which includes the feature.
  3. Remove the interface-binding flag from the invocation if binding is not actually required.

Example fix

// before
cargo install xh --no-default-features
// after
cargo install xh --features network-interface
Defensive patterns

Strategy: validation

Validate before calling

// before shipping a minimal build, confirm the feature is on:
// cargo tree -e features | grep network-interface  (or check Cargo.toml features)
// runtime guard in a wrapper script:
if ! xh --help | grep -q interface; then echo 'xh build lacks network-interface support'; exit 1; fi

Prevention

When it happens

Trigger: Running a binary built with `--no-default-features` or a feature set excluding `network-interface`, then invoking xh with the option to bind to a network interface (e.g. `--interface`).

Common situations: Using a distro-packaged or minimal build of xh that strips optional features; building with `cargo install xh --no-default-features`; Docker/CI images built with a reduced feature set.

Related errors


AI-assisted analysis of ducaale/xh@2404aceecc (2026-09-13). Data as JSON: /api/errors/8a09cb242b5ae605. Report an issue: GitHub.

Appendix: source

Thrown at src/main.rs:351

            {
                client = client.interface(name_or_ip);
            }

            #[cfg(not(any(
                target_os = "android",
                target_os = "fuchsia",
                target_os = "illumos",
                target_os = "ios",
                target_os = "linux",
                target_os = "macos",
                target_os = "solaris",
                target_os = "tvos",
                target_os = "visionos",
                target_os = "watchos",
            )))]
            {
                #[cfg(not(feature = "network-interface"))]
                return Err(anyhow!(
                    "This binary was built without support for binding to interfaces. Enable the `network-interface` feature."
                ));

                #[cfg(feature = "network-interface")]
                {
                    use network_interface::{NetworkInterface, NetworkInterfaceConfig};
                    let ip_addr = NetworkInterface::show()?
                        .iter()
                        .find_map(|interface| {
                            if &interface.name == name_or_ip {
                                if let Some(addr) = interface.addr.first() {
                                    return Some(addr.ip());
                                }
                            }
                            None
                        })
                        .with_context(|| format!("Couldn't bind to {:?}", name_or_ip))?;
                    log::debug!("Resolved {name_or_ip:?} to {ip_addr:?}");

View on GitHub (pinned to 2404aceecc)