{"record":{"id":"7a1608d34c23ddbd","repo":"n0-computer/iroh","slug":"networkdown","errorCode":"NetworkDown","errorMessage":"All transports failed to receive","messagePattern":"All transports failed to receive","errorType":"error_code","errorClass":"io::Error","httpStatus":null,"severity":"critical","filePath":"iroh/src/socket/transports.rs","lineNumber":351,"sourceCode":"            for transport in self.relay.iter_mut().rev() {\n                poll_transport!(transport);\n            }\n            #[cfg(not(wasm_browser))]\n            for transport in self.ip.iter_mut() {\n                poll_transport!(transport);\n            }\n        }\n\n        if total_polled == total_errors {\n            // All transports errored.\n            self.consecutive_total_recv_failures += 1;\n            debug!(\n                \"All transports failed to receive ({} remaining)\",\n                MAX_CONSECUTIVE_RECV_ERRORS.wrapping_sub(self.consecutive_total_recv_failures)\n            );\n            if self.consecutive_total_recv_failures >= MAX_CONSECUTIVE_RECV_ERRORS {\n                warn!(\"All transports failed to receive. QUIC endpoint will be shutdown.\");\n                Poll::Ready(Err(io::Error::new(\n                    io::ErrorKind::NetworkDown,\n                    \"All transports failed to receive\",\n                )))\n            } else {\n                Poll::Ready(Ok(0))\n            }\n        } else {\n            // At least one transport is pending or returned Ok(0).\n            self.consecutive_total_recv_failures = 0;\n            if return_ready {\n                Poll::Ready(Ok(0))\n            } else {\n                Poll::Pending\n            }\n        }\n    }\n\n    /// Returns a list of all currently known local addresses.","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/n0-computer/iroh/blob/2b4de030ce5e0133f272871a76f0c685c63f552a/iroh/src/socket/transports.rs#L333-L369","documentation":"The QUIC socket's transport poll_recv loop hit MAX_CONSECUTIVE_RECV_ERRORS consecutive receive failures across all transports. The endpoint concludes the network is down, returns io::ErrorKind::NetworkDown, and shuts the QUIC endpoint down rather than spinning forever on errors.","triggerScenarios":"poll_recv repeatedly returning errors for every transport (relay and UDP) MAX_CONSECUTIVE_RECV_ERRORS times in a row — e.g. sockets closed underneath, OS network interface flapping, all underlying transports erroring on recv.","commonSituations":"Laptop suspending/resuming or interface changes killing UDP sockets, containers losing their network namespace, firewall/VPN changes breaking all local transports, running in environments where UDP is blocked and the relay transport also fails.","solutions":["Recreate/restart the Endpoint (and its sockets) when NetworkDown is returned; it is designed to signal a full teardown.","Diagnose why the underlying transports fail to recv: check interface state, permissions, and firewall rules.","Retry application-level connection attempts with backoff after the network recovers.","Monitor the warn! log ('All transports failed to receive') to correlate with environment changes."],"exampleFix":"// before\nlet conn = endpoint.connect(addr, alpn).await?; // fails after NetworkDown teardown\n// after\nmatch endpoint.connect(addr, alpn).await {\n    Ok(c) => c,\n    Err(e) if e.kind() == NetworkDown => { endpoint = recreate_endpoint().await?; endpoint.connect(addr, alpn).await? }\n    Err(e) => return Err(e.into()),\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":"fn is_network_down(e: &std::io::Error) -> bool { e.kind() == std::io::ErrorKind::NetworkDown }","tryCatchPattern":"match ep_transport_recv() {\n    Err(e) if e.kind() == std::io::ErrorKind::NetworkDown => { rebuild_endpoint_with_backoff().await?; }\n    other => other?,\n}","preventionTips":["Monitor interface changes (suspend/resume, VPN) and proactively rebuild sockets.","Use exponential backoff when recreating the endpoint.","Alert on the 'All transports failed to receive' warning log.","Test app behavior in degraded-network environments."],"tags":["network","transports","quic","shutdown"],"backgroundTag":"network-request-failed","analyzedSha":"2b4de030ce5e0133f272871a76f0c685c63f552a","analyzedAt":"2026-09-08T04:26:47.755Z","contentChangedAt":"2026-09-08T04:26:47.755Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}