netbirdio/netbird · error

apply destination

Error message

apply destination: %w

What it means

Translating the destination network of a route rule into nftables expressions failed. The source side already succeeded; the destination prefix or domain set could not be converted for this address family.

Solutions

  1. Validate the destination prefix format and family
  2. Avoid mixing v4 and v6 destinations in one rule
  3. Retry with a smaller prefix set
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at client/firewall/nftables/router_linux.go:420 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/ca194d6cff11d14d. Report an issue: GitHub.

Appendix: source

Thrown at client/firewall/nftables/router_linux.go:420

	case len(sources) == 1 && sources[0].Bits() == 0:
		// If it's 0.0.0.0/0, we don't need to add any source matching
	case len(sources) == 1:
		// If there's only one source, we can use it directly
		source.Prefix = sources[0]
	default:
		// If there are multiple sources, use a set
		source.Set = firewall.NewPrefixSet(sources)
	}

	sourceExp, err := r.applyNetwork(source, sources, true)
	if err != nil {
		return nil, fmt.Errorf("apply source: %w", err)
	}
	exprs = append(exprs, sourceExp...)

	destExp, err := r.applyNetwork(destination, nil, false)
	if err != nil {
		return nil, fmt.Errorf("apply destination: %w", err)
	}
	exprs = append(exprs, destExp...)

	// Handle protocol
	if proto != firewall.ProtocolALL {
		protoNum, err := r.af.protoNum(proto)
		if err != nil {
			return nil, fmt.Errorf("convert protocol to number: %w", err)
		}
		exprs = append(exprs, &expr.Meta{Key: expr.MetaKeyL4PROTO, Register: 1})
		exprs = append(exprs, &expr.Cmp{
			Op:       expr.CmpOpEq,
			Register: 1,
			Data:     []byte{protoNum},
		})

		exprs = append(exprs, applyPort(sPort, true)...)
		exprs = append(exprs, applyPort(dPort, false)...)

View on GitHub (pinned to 93e97f4bf1)