imsnif/bandwhich · critical

Failed to find any network interface to listen on.

Error message

Failed to find any network interface to listen on.

What it means

During input setup bandwhich enumerates network interfaces via `get_input` and filters to available ones. If none are up/available it cannot capture packets at all, so it bails with this fatal message.

Solutions

  1. Bring up a network interface (`sudo ip link set <iface> up`) before running bandwhich
  2. Check available interfaces with `ip link` / `ifconfig` and confirm at least one is UP
  3. In containers, ensure the container has network interfaces configured
  4. Pass the intended interface explicitly with `-i <name>` if auto-detection filters it out

Example fix

// before
sudo bandwhich
// after
sudo ip link set eth0 up
sudo bandwhich -i eth0
Defensive patterns

Strategy: validation

Validate before calling

// shell: ensure at least one interface is up before running
if ! ip -o link show up | grep -qv 'lo:'; then
  echo "No network interface is up"; exit 1
fi

Try / catch

sudo bandwhich -i "$IFACE" || { echo "no usable interface; check 'ip link'"; exit 1; }

Prevention

When it happens

Trigger: `get_input()` finds `available_interfaces.is_empty()` after filtering the system's interface list (e.g. all interfaces down, or filtering removed everything).

Common situations: Running on machines/virtualized containers with no NICs up, running before network is brought up, interfaces named unexpectedly being filtered out, or running in restricted containers (Docker without network namespace setup).

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of imsnif/bandwhich@1899870cea (2026-09-08). Data as JSON: /api/errors/8839ee74d3eb3dd9. Report an issue: GitHub.

Appendix: source

Thrown at src/os/shared.rs:140

        .unwrap_or_else(datalink::interfaces)
        .into_iter()
        .filter(|interface| {
            // see https://github.com/libpnet/libpnet/issues/564
            let keep = if cfg!(target_os = "windows") {
                !interface.ips.is_empty()
            } else {
                interface.is_up() && !interface.ips.is_empty()
            };
            if !keep {
                debug!("{} is down. Skipping it.", interface.name);
            }
            keep
        })
        .collect_vec();

    // bail if no interfaces are up
    if available_interfaces.is_empty() {
        bail!("Failed to find any network interface to listen on.");
    }

    // try to get a frame receiver for each interface
    let interfaces_with_frames_res = available_interfaces
        .into_iter()
        .map(|interface| {
            let frames_res = get_datalink_channel(&interface);
            (interface, frames_res)
        })
        .collect_vec();

    // warn for all frame receivers we failed to acquire
    interfaces_with_frames_res
        .iter()
        .filter_map(|(interface, frames_res)| frames_res.as_ref().err().map(|err| (interface, err)))
        .for_each(|(interface, err)| {
            warn!(
                "Failed to acquire a frame receiver for {}: {err}",

View on GitHub (pinned to 1899870cea)