slackhq/nebula · error

SO_REUSEPORT failed: %v

Error message

SO_REUSEPORT failed: %v

What it means

Error inside the Darwin ListenConfig Control callback: SetsockoptInt failed while enabling SO_REUSEPORT on the UDP socket. The kernel refused the option (e.g. unsupported), and the error from inside c.Control is surfaced, failing listener creation when multi is requested.

Source

Thrown at udp/udp_darwin.go:71

		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 controlErr
				}
			}

			return nil
		},
	}
}

//go:linkname sendto golang.org/x/sys/unix.sendto
//go:noescape

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Disable multi-listener mode so SO_REUSEPORT is not set
  2. Verify macOS/kernel support for SO_REUSEPORT on UDP
  3. Inspect the errno in the message for the exact refusal
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at udp/udp_darwin.go:71 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/816927669e1c1554. Report an issue: GitHub.