slackhq/nebula · error

LocalAddr returned invalid IP address: %s

Error message

LocalAddr returned invalid IP address: %s

What it means

Type-guard failure in Darwin StdConn.LocalAddr: the socket's local address is a *net.UDPAddr whose IP slice could not be converted via netip.AddrFromSlice (bad 4/16-byte length). The raw IP is printed; it indicates a corrupt address from the runtime.

Source

Thrown at udp/udp_darwin.go:166

	written := 0
	for i, b := range bufs {
		if err := u.WriteTo(b, addrs[i]); err == nil {
			written++
		} else {
			u.l.Debug("failed to write packet in batch", "udpAddr", addrs[i], "error", err)
		}
	}
	return written, nil
}

func (u *StdConn) LocalAddr() (netip.AddrPort, error) {
	a := u.UDPConn.LocalAddr()

	switch v := a.(type) {
	case *net.UDPAddr:
		addr, ok := netip.AddrFromSlice(v.IP)
		if !ok {
			return netip.AddrPort{}, fmt.Errorf("LocalAddr returned invalid IP address: %s", v.IP)
		}
		return netip.AddrPortFrom(addr, uint16(v.Port)), nil

	default:
		return netip.AddrPort{}, fmt.Errorf("LocalAddr returned: %#v", a)
	}
}

func (u *StdConn) ReloadConfig(c *config.C) {
	// TODO
}

func NewUDPStatsEmitter(udpConns []Conn) func() {
	// No UDP stats for non-linux
	return func() {}
}

func (u *StdConn) ListenOut(r EncReader, flush func()) error {

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Firewall rules or unusual binding configurations can yield an IP netip.AddrFromSlice rejects (nil or wrong-length slice); verify the listen host in config is a valid IPv4/IPv6 address, not a hostname or empty value
  2. Ensure the UDP socket is bound to a concrete address rather than an unspecified/invalid one; check the 'listen.host' setting in the nebula config
  3. This fires when UDPConn.LocalAddr returns a *net.UDPAddr whose IP cannot convert to netip.Addr (typically a nil IP); restarting with a corrected listen address resolves it
  4. If it occurs with systemd socket activation or inherited fds, confirm the passed socket has a valid bound address
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at udp/udp_darwin.go:166 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/2ab1b77db321859d. Report an issue: GitHub.