slackhq/nebula · error

entry %v.metric in tun.unsafe_routes is not an integer: %v

Error message

entry %v.metric in tun.unsafe_routes is not an integer: %v

What it means

Config validation error in parseUnsafeRoutes: the `metric` key of the i+1-th entry is a string that strconv.ParseInt(bitsize 32) rejected — not a valid 32-bit integer literal. The Atoi/ParseInt error is included.

Source

Thrown at overlay/route.go:197

					return nil, fmt.Errorf("entry %v.mtu in tun.unsafe_routes is not an integer: %v", i+1, err)
				}
			}

			if mtu != 0 && mtu < 500 {
				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 {

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Write metric as a plain integer within int32 range
  2. Remove the metric key to use the default 0
Defensive patterns

Strategy: validation

When it happens

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