cloudflare/quiche · error · io::Error
Unsupported
Unsupported
Error message
invalid address family
What it means
datagram-socket's socket abstraction only implements send paths for AF_INET/AF_INET6 sockets. This poll_send_to is a fallback stub (for unsupported address families, e.g. unix/other) that always returns io::ErrorKind::Unsupported, so any send attempted through it can never succeed.
Solutions
- Ensure the socket is bound to an IPv4 or IPv6 address before using poll_send_to
- Check how the socket was constructed (from_datagram / socket2 setup) and only use AF_INET/AF_INET6
- If you need another family, add a real implementation for that cfg branch instead of relying on the stub
Example fix
// before
let addr: SocketAddr = "[::1]:443".parse()?; // fine; but a unix/other family addr hits the stub
socket.send_to(buf, addr).await?;
// after
if !matches!(addr, SocketAddr::V4(_) | SocketAddr::V6(_)) {
return Err(io::Error::new(io::ErrorKind::Unsupported, "non-IP family"));
}
socket.send_to(buf, addr).await?; Defensive patterns
Strategy: validation
Validate before calling
fn is_ip_family(addr: std::net::SocketAddr) -> bool {
matches!(addr, std::net::SocketAddr::V4(_) | std::net::SocketAddr::V6(_))
}
// call before send_to / poll_send_to
if !is_ip_family(target) { return Err(...); } Type guard
fn is_ip_family(addr: std::net::SocketAddr) -> bool {
matches!(addr, std::net::SocketAddr::V4(_) | std::net::SocketAddr::V6(_))
} Prevention
- Always bind datagram sockets to IPv4 or IPv6 addresses
- Check the socket's local_addr().is_ipv4()/is_ipv6() before sending
- Treat io::ErrorKind::Unsupported from send paths as a configuration bug, not transient
When it happens
Trigger: Calling poll_send_to (via the AsyncSocket send path / poll_send machinery) on a datagram socket whose address family is not IPv4/IPv6, i.e. hitting the #[cfg] fallback implementation in datagram.rs:692.
Common situations: Passing a socket created from an address family other than IPv4/IPv6 into the datagram-socket send API; binding from a SocketAddr the crate does not support; misconfiguration on unusual platforms.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Error creating file for
- Error creating qlog file attempted path was
- send_to_gso() should not be called on non-linux platforms
AI-assisted analysis of cloudflare/quiche@9f96daa2c2 (2026-09-08).
Data as JSON: /api/errors/955f4f88f02f26bc.
Report an issue: GitHub.
Appendix: source
Thrown at datagram-socket/src/datagram.rs:692
}
fn into_fd(self) -> Option<OwnedFd> {
Some(into_owned_fd(self.into_std().ok()?))
}
}
#[cfg(unix)]
impl DatagramSocketSend for UnixDatagram {
#[inline]
fn poll_send(&self, cx: &mut Context, buf: &[u8]) -> Poll<io::Result<usize>> {
UnixDatagram::poll_send(self, cx, buf)
}
#[inline]
fn poll_send_to(
&self, _: &mut Context, _: &[u8], _: SocketAddr,
) -> Poll<io::Result<usize>> {
Poll::Ready(Err(io::Error::new(
io::ErrorKind::Unsupported,
"invalid address family",
)))
}
#[cfg(target_os = "linux")]
#[inline]
fn poll_send_many(
&self, cx: &mut Context, bufs: &[ReadBuf<'_>],
) -> Poll<io::Result<usize>> {
crate::poll_sendmmsg!(self, cx, bufs)
}
}
#[cfg(unix)]
impl DatagramSocketRecv for UnixDatagram {
#[inline]
fn poll_recv(View on GitHub (pinned to 9f96daa2c2)