{"record":{"id":"d87e0dac44898c1a","repo":"tauri-apps/tauri","slug":"failed-to-list-networks","errorCode":null,"errorMessage":"failed to list networks","messagePattern":"failed to list networks","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/mobile/mod.rs","lineNumber":185,"sourceCode":"}\n\n#[derive(Debug, Default, Clone, Serialize, Deserialize)]\npub struct CliOptions {\n  pub dev: bool,\n  pub features: Vec<String>,\n  pub args: Vec<String>,\n  pub noise_level: NoiseLevel,\n  pub vars: HashMap<String, OsString>,\n  pub config: Vec<ConfigValue>,\n  pub target_device: Option<TargetDevice>,\n}\n\nfn local_ip_address(force: bool) -> &'static IpAddr {\n  static LOCAL_IP: OnceLock<IpAddr> = OnceLock::new();\n  LOCAL_IP.get_or_init(|| {\n    let prompt_for_ip = || {\n      let addresses: Vec<IpAddr> = local_ip_address::list_afinet_netifas()\n        .expect(\"failed to list networks\")\n        .into_iter()\n        .map(|(_, ipaddr)| ipaddr)\n        .filter(|ipaddr| match ipaddr {\n          IpAddr::V4(i) => i != &Ipv4Addr::LOCALHOST,\n          IpAddr::V6(i) => i.to_string().ends_with(\"::2\"),\n\n        })\n        .collect();\n      match addresses.as_slice() {\n        [] => panic!(\"No external IP detected.\"),\n        [ipaddr] => *ipaddr,\n        _ => {\n          let selected = dialoguer::Select::with_theme(&dialoguer::theme::ColorfulTheme::default())\n            .with_prompt(\n              \"Failed to detect external IP, What IP should we use to access your development server?\",\n            )\n            .items(&addresses)\n            .default(0)","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/mobile/mod.rs#L167-L203","documentation":"For mobile dev, the CLI needs the host IP so the device can reach the dev server. local_ip_address::list_afinet_netifas() enumerates network interfaces via the OS getifaddrs-style API; this expect fires when that enumeration itself errors. It is environment-level: the syscall failing is rare and usually tied to sandboxes or an unstable network stack.","triggerScenarios":"Running `tauri android dev` / `tauri ios dev` in containers or restricted sandboxes where interface enumeration fails, or transiently while the network stack is being reconfigured (VPN connecting, docker creating bridges).","commonSituations":"Dev containers with dropped capabilities; macOS network extension transitions; VPN clients mid-handoff; systems with hundreds of virtual interfaces in flux.","solutions":["Re-run the command once the network stack settles (after VPN/docker changes complete).","Disconnect VPNs / prune unused docker networks so enumeration has a stable interface set.","Move out of restrictive containers/sandboxes for mobile dev runs.","If persistent, capture `ifconfig -a` (or `ip addr`) output and open an issue against the local-ip-address crate usage."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Mobile dev wrapper: retry once; interface enumeration failures are transient\nfor (let i = 0; i < 2; i++) {\n  const r = spawnSync(\"npx\", [\"tauri\", \"android\", \"dev\"], { stdio: \"inherit\" });\n  if (r.status === 0) break;\n  if (i === 0) setTimeout(() => {}, 2000); // let VPN/docker settle before retry\n}","preventionTips":["Run mobile dev outside restrictive containers/sandboxes.","Avoid kicking off `tauri <mobile> dev` while VPN clients or docker are mid-reconfiguration.","Prune unused network interfaces (docker network prune) on dev machines with many adapters."],"tags":["mobile","network","network-interfaces","dev-server"],"backgroundTag":"network-interface-enumeration-failed","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}