XTLS/Xray-core · error
default route not found
Error message
default route not found
What it means
Darwin automatic outbound-interface selection scanned the routing socket messages and found no usable default route (no AF_INET entry and no AF_INET6 fallback), so the TUN stack has no interface to bind to.
Solutions
- Ensure the system has a default route (network is up)
- Or set a fixed outbound interface name in the TUN config
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at proxy/tun/tun_darwin.go:527 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/8e82ab7aff1bc308.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/tun/tun_darwin.go:527
continue
}
family, ok := defaultRouteFamily(routeMessage)
if !ok {
continue
}
if family == unix.AF_INET {
return usableDarwinInterface(routeMessage.Index)
}
if family == unix.AF_INET6 && ipv6Index == 0 {
ipv6Index = routeMessage.Index
}
}
if ipv6Index != 0 {
return usableDarwinInterface(ipv6Index)
}
return nil, errors.New("default route not found")
}
func defaultRouteFamily(message *route.RouteMessage) (int, bool) {
if len(message.Addrs) <= unix.RTAX_NETMASK {
return 0, false
}
switch destination := message.Addrs[unix.RTAX_DST].(type) {
case *route.Inet4Addr:
mask, ok := message.Addrs[unix.RTAX_NETMASK].(*route.Inet4Addr)
if !ok || destination.IP != netip.IPv4Unspecified().As4() {
return 0, false
}
ones, bits := net.IPMask(mask.IP[:]).Size()
return unix.AF_INET, ones == 0 && bits == 32
case *route.Inet6Addr:
mask, ok := message.Addrs[unix.RTAX_NETMASK].(*route.Inet6Addr)
if !ok || destination.IP != netip.IPv6Unspecified().As16() {View on GitHub (pinned to 7d214f8b09)