slackhq/nebula · error

entry %v.metric in tun.unsafe_routes is not in range (0-%d)

Error message

entry %v.metric in tun.unsafe_routes is not in range (0-%d) : %v

What it means

Config validation error in parseUnsafeRoutes: the i+1-th entry's metric is outside the allowed 0..MaxInt32 range (negative or too large). Route metrics feed OS routing APIs that require a non-negative 32-bit value.

Source

Thrown at overlay/route.go:202

				return nil, fmt.Errorf("entry %v.mtu in tun.unsafe_routes is below 500: %v", i+1, mtu)
			}
		}

		rMetric, ok := m["metric"]
		if !ok {
			rMetric = 0
		}

		metric, ok := rMetric.(int)
		if !ok {
			_, err = strconv.ParseInt(rMetric.(string), 10, 32)
			if err != nil {
				return nil, fmt.Errorf("entry %v.metric in tun.unsafe_routes is not an integer: %v", i+1, err)
			}
		}

		if metric < 0 || metric > math.MaxInt32 {
			return nil, fmt.Errorf("entry %v.metric in tun.unsafe_routes is not in range (0-%d) : %v", i+1, math.MaxInt32, metric)
		}

		rVia, ok := m["via"]
		if !ok {
			return nil, fmt.Errorf("entry %v.via in tun.unsafe_routes is not present", i+1)
		}

		var gateways routing.Gateways

		switch via := rVia.(type) {
		case string:
			viaIp, err := netip.ParseAddr(via)
			if err != nil {
				return nil, fmt.Errorf("entry %v.via in tun.unsafe_routes failed to parse address: %v", i+1, err)
			}

			gateways = routing.Gateways{routing.NewGateway(viaIp, 1)}

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Set metric between 0 and 2147483647
  2. Remove the metric key to use the default
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at overlay/route.go:202 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/c322c1d455cc0aa2. Report an issue: GitHub.