slackhq/nebula · error

entry .gateway in tun.unsafe_routes[%v].via[%v] is not a str

Error message

entry .gateway in tun.unsafe_routes[%v].via[%v] is not a string

What it means

Configuration validation error in parseUnsafeRoutes for multipath unsafe routes. After confirming a 'via' list entry has a 'gateway' key, the value is type-asserted to a string; this fires when gateway is present but of the wrong YAML type (e.g. a number, IP-literal object, or nested map) instead of a string address, so it cannot be passed to netip.ParseAddr.

Source

Thrown at overlay/route.go:236

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

		case []any:
			gateways = make(routing.Gateways, len(via))
			for ig, v := range via {
				gatewayMap, ok := v.(map[string]any)
				if !ok {
					return nil, fmt.Errorf("entry %v in tun.unsafe_routes[%v].via is invalid", i+1, ig+1)
				}

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

				parsedGateway, ok := rGateway.(string)
				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)
					}

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Quote the gateway value or write it as an IP string, e.g. gateway: "10.0.0.1"
Defensive patterns

Strategy: validation

When it happens

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