slackhq/nebula · error
unexpected PacketConn: %T %#v
Error message
unexpected PacketConn: %T %#v
What it means
Type-guard failure at the end of the Darwin NewListener: ListenPacket returned something that is not a *net.UDPConn (its concrete type and value are printed). Practically unreachable with the "udp" network string; if hit, it means an unexpected netpoll wrapper was returned.
Source
Thrown at udp/udp_darwin.go:61
}
err = rc.Control(func(fd uintptr) {
c.sysFd = fd
})
if err != nil {
return nil, fmt.Errorf("failed to get udp fd: %w", err)
}
la, err := c.LocalAddr()
if err != nil {
return nil, err
}
c.isV4 = la.Addr().Is4()
return c, nil
}
return nil, fmt.Errorf("unexpected PacketConn: %T %#v", pc, pc)
}
func NewListenConfig(multi bool) net.ListenConfig {
return net.ListenConfig{
Control: func(network, address string, c syscall.RawConn) error {
if multi {
var controlErr error
err := c.Control(func(fd uintptr) {
if err := syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, unix.SO_REUSEPORT, 1); err != nil {
controlErr = fmt.Errorf("SO_REUSEPORT failed: %v", err)
return
}
})
if err != nil {
return err
}
if controlErr != nil {
return controlErrView on GitHub (pinned to dd8f660c0a)
Solutions
- This is a defensive assertion: on macOS the listener first tries to obtain a udp_sock via Control-based fd extraction from a *net.UDPConn and returns early; reaching this error means the ListenPacket-based fallback returned a PacketConn that is neither a udp_sock nor a *net.UDPConn
- Check which nebula UDP path is active on this Darwin build; a non-standard build tag or stubbed network stack can produce an unexpected PacketConn concrete type
- Update Go and nebula: changes in net package behavior across Go versions can alter the concrete type returned by ListenPacket
- If reproducible, file a nebula issue with the %T/%#v detail printed in the error — it names the unexpected concrete type
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at udp/udp_darwin.go:61 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of slackhq/nebula@dd8f660c0a (2026-09-03).
Data as JSON: /api/errors/a0c64f8f21782079.
Report an issue: GitHub.