slackhq/nebula · error

entry .weight in tun.unsafe_routes[%v].via[%v] is not an int

Error message

entry .weight in tun.unsafe_routes[%v].via[%v] is not an integer

What it means

Config validation error in parseUnsafeRoutes: the `weight` key of a via-list gateway is a string that ParseInt(bitsize 32) rejected — not a valid 32-bit integer. Weight defaults to 1 when the key is absent, but an unparseable explicit value fails.

Source

Thrown at overlay/route.go:253

				if !ok {
					return nil, fmt.Errorf("entry .gateway in tun.unsafe_routes[%v].via[%v] is not a string", i+1, ig+1)
				}

				gatewayIp, err := netip.ParseAddr(parsedGateway)
				if err != nil {
					return nil, fmt.Errorf("entry .gateway in tun.unsafe_routes[%v].via[%v] failed to parse address: %v", i+1, ig+1, err)
				}

				rGatewayWeight, ok := gatewayMap["weight"]
				if !ok {
					rGatewayWeight = 1
				}

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

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

				gateways[ig] = routing.NewGateway(gatewayIp, gatewayWeight)

			}

		default:
			return nil, fmt.Errorf("entry %v.via in tun.unsafe_routes is not a string or list of gateways: found %T", i+1, rVia)
		}

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

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Write weight as a plain integer (1..MaxInt32)
  2. Remove the weight key to use the default of 1
Defensive patterns

Strategy: validation

When it happens

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