{"record":{"id":"82bbbff9cc47a296","repo":"embassy-rs/embassy","slug":"ipv6-support-not-enabled","errorCode":null,"errorMessage":"ipv6 support not enabled","messagePattern":"ipv6 support not enabled","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-net/src/tcp.rs","lineNumber":1344,"sourceCode":"    impl<'d, const N: usize, const TX_SZ: usize, const RX_SZ: usize> embedded_nal_async::TcpConnect\n        for TcpClient<'d, N, TX_SZ, RX_SZ>\n    {\n        type Error = Error;\n        type Connection<'m>\n            = TcpConnection<'m, 'd, N, TX_SZ, RX_SZ>\n        where\n            Self: 'm;\n\n        async fn connect<'a>(&'a self, remote: core::net::SocketAddr) -> Result<Self::Connection<'a>, Self::Error> {\n            let addr: crate::wire::IpAddress = match remote.ip() {\n                #[cfg(feature = \"ipv4\")]\n                IpAddr::V4(addr) => crate::wire::IpAddress::Ipv4(addr),\n                #[cfg(not(feature = \"ipv4\"))]\n                IpAddr::V4(_) => panic!(\"ipv4 support not enabled\"),\n                #[cfg(feature = \"ipv6\")]\n                IpAddr::V6(addr) => crate::wire::IpAddress::Ipv6(addr),\n                #[cfg(not(feature = \"ipv6\"))]\n                IpAddr::V6(_) => panic!(\"ipv6 support not enabled\"),\n            };\n            let remote_endpoint = (addr, remote.port());\n            let mut socket = TcpConnection::new(self.stack, self.state)?;\n            socket.socket.set_timeout(self.socket_timeout);\n            socket\n                .socket\n                .connect(remote_endpoint)\n                .await\n                .map_err(|_| Error::ConnectionReset)?;\n            Ok(socket)\n        }\n    }\n\n    /// Opened TCP connection in a [`TcpClient`].\n    ///\n    /// `'a` is the lifetime of the borrow of the [`TcpClient`] (whose pool the\n    /// connection's buffers come from), `'d` the lifetime of the stack.\n    pub struct TcpConnection<'a, 'd, const N: usize, const TX_SZ: usize, const RX_SZ: usize> {","sourceCodeStart":1326,"sourceCodeEnd":1362,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-net/src/tcp.rs#L1326-L1362","documentation":"This panic is emitted when an application calls TcpConnector::connect with a remote address of type IpAddr::V6 while the embassy-net crate was compiled without the `ipv6` feature. embassy-net only instantiates address conversion code for the address families actually enabled via cargo features, so an IPv6 address cannot be represented and the library deliberately panics instead of silently failing. It is a build-configuration error, not a runtime condition that can be recovered from.","triggerScenarios":"Calling `TcpConnector::connect` on an embassy-net stack with a `SocketAddr`/`IpAddr` in the V6 variant while the crate was built without `features = [\"ipv6\"]`. Typical when resolving a hostname that returns an AAAA record and using the v6 result first.","commonSituations":"Developer enables dual-stack at the application level but forgets the `ipv6` feature on embassy-net in Cargo.toml; a DNS resolver returns an IPv6 address first; code was ported from std where Ipv6Addr always exists.","solutions":["Add the `ipv6` feature to embassy-net in Cargo.toml: `embassy-net = { version = \"...\", features = [\"ipv6\"] }`","Filter resolved addresses to IPv4 only when ipv6 support is not compiled in","Verify the feature is actually activated (check `cargo tree -f '{p} {f}'` for embassy-net) — it may be disabled by a dependency's default-features choice"],"exampleFix":"// before (Cargo.toml)\nembassy-net = { version = \"0.6\", features = [\"tcp\"] }\n// after\nembassy-net = { version = \"0.6\", features = [\"tcp\", \"ipv6\"] }","handlingStrategy":"validation","validationCode":"fn ensure_supported(addr: core::net::IpAddr) -> core::net::IpAddr {\n    if matches!(addr, core::net::IpAddr::V6(_)) && !cfg!(feature = \"ipv6\") {\n        panic!(\"ipv6 not enabled in embassy-net; build with the ipv6 feature\");\n    }\n    addr\n}\n// call before connect: let addr = ensure_supported(remote.ip());","typeGuard":"fn is_ipv4(addr: core::net::IpAddr) -> bool { matches!(addr, core::net::IpAddr::V4(_)) }","tryCatchPattern":null,"preventionTips":["Enable the `ipv6` feature in embassy-net when any part of the app may dial IPv6","Prefer IPv4 addresses from resolvers when the feature is off","Check enabled features with `cargo tree -f '{p} {f}'` in CI"],"tags":["network","embedded","ipv6","feature-flags"],"backgroundTag":"feature-not-enabled","analyzedSha":"463a07b963419a1bfe61d5d597c44acb810afb8b","analyzedAt":"2026-09-10T13:38:26.660Z","contentChangedAt":"2026-09-10T13:38:26.660Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}