{"record":{"id":"8839ee74d3eb3dd9","repo":"imsnif/bandwhich","slug":"failed-to-find-any-network-interface-to-listen-on","errorCode":null,"errorMessage":"Failed to find any network interface to listen on.","messagePattern":"Failed to find any network interface to listen on\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/os/shared.rs","lineNumber":140,"sourceCode":"        .unwrap_or_else(datalink::interfaces)\n        .into_iter()\n        .filter(|interface| {\n            // see https://github.com/libpnet/libpnet/issues/564\n            let keep = if cfg!(target_os = \"windows\") {\n                !interface.ips.is_empty()\n            } else {\n                interface.is_up() && !interface.ips.is_empty()\n            };\n            if !keep {\n                debug!(\"{} is down. Skipping it.\", interface.name);\n            }\n            keep\n        })\n        .collect_vec();\n\n    // bail if no interfaces are up\n    if available_interfaces.is_empty() {\n        bail!(\"Failed to find any network interface to listen on.\");\n    }\n\n    // try to get a frame receiver for each interface\n    let interfaces_with_frames_res = available_interfaces\n        .into_iter()\n        .map(|interface| {\n            let frames_res = get_datalink_channel(&interface);\n            (interface, frames_res)\n        })\n        .collect_vec();\n\n    // warn for all frame receivers we failed to acquire\n    interfaces_with_frames_res\n        .iter()\n        .filter_map(|(interface, frames_res)| frames_res.as_ref().err().map(|err| (interface, err)))\n        .for_each(|(interface, err)| {\n            warn!(\n                \"Failed to acquire a frame receiver for {}: {err}\",","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/imsnif/bandwhich/blob/1899870cea8bb377948f05cfea64733ec6ea2cd6/src/os/shared.rs#L122-L158","documentation":"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.","triggerScenarios":"`get_input()` finds `available_interfaces.is_empty()` after filtering the system's interface list (e.g. all interfaces down, or filtering removed everything).","commonSituations":"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).","solutions":["Bring up a network interface (`sudo ip link set <iface> up`) before running bandwhich","Check available interfaces with `ip link` / `ifconfig` and confirm at least one is UP","In containers, ensure the container has network interfaces configured","Pass the intended interface explicitly with `-i <name>` if auto-detection filters it out"],"exampleFix":"// before\nsudo bandwhich\n// after\nsudo ip link set eth0 up\nsudo bandwhich -i eth0","handlingStrategy":"validation","validationCode":"// shell: ensure at least one interface is up before running\nif ! ip -o link show up | grep -qv 'lo:'; then\n  echo \"No network interface is up\"; exit 1\nfi","typeGuard":null,"tryCatchPattern":"sudo bandwhich -i \"$IFACE\" || { echo \"no usable interface; check 'ip link'\"; exit 1; }","preventionTips":["Verify `ip link` shows a non-loopback interface in UP state before running","Bring interfaces up explicitly in VMs/containers (`ip link set <iface> up`)","Use `-i <name>` when auto-detection would find nothing","Check that you are in the expected network namespace"],"tags":["network","interfaces","rust"],"backgroundTag":"resource-not-found","analyzedSha":"1899870cea8bb377948f05cfea64733ec6ea2cd6","analyzedAt":"2026-09-08T10:26:38.858Z","contentChangedAt":"2026-09-08T10:26:38.858Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}