slackhq/nebula · error

entry %v.route in tun.routes failed to parse: %v

Error message

entry %v.route in tun.routes failed to parse: %v

What it means

The route value of a tun.routes entry could not be parsed as a CIDR prefix. parseRoutes formats the value with %v and calls netip.ParsePrefix; any parse failure (bad format, missing prefix length, invalid IP, wrong type like a nested map) is wrapped in this error.

Source

Thrown at overlay/route.go:123

		}

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

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

		r := Route{
			Install: true,
			MTU:     mtu,
		}

		r.Cidr, err = netip.ParsePrefix(fmt.Sprintf("%v", rRoute))
		if err != nil {
			return nil, fmt.Errorf("entry %v.route in tun.routes failed to parse: %v", i+1, err)
		}

		found := false
		for _, network := range networks {
			if network.Contains(r.Cidr.Addr()) && r.Cidr.Bits() >= network.Bits() {
				found = true
				break
			}
		}

		if !found {
			return nil, fmt.Errorf(
				"entry %v.route in tun.routes is not contained within the configured vpn networks; route: %v, networks: %v",
				i+1,
				r.Cidr.String(),
				networks,
			)
		}

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Provide a valid CIDR prefix such as 10.0.0.0/24 (IP + /prefix-length)
  2. Validate the CIDR with netip.ParsePrefix in a scratch script or an online CIDR checker before committing
  3. Remove whitespace/quotes issues around the value
  4. The inner %v contains the exact netip error — fix the address component it names

Example fix

// before
- mtu: 1300
  route: 10.0.0.1
// after
- mtu: 1300
  route: 10.0.0.0/24
Defensive patterns

Strategy: validation

Validate before calling

routeStr := fmt.Sprintf("%v", m["route"])
if _, err := netip.ParsePrefix(routeStr); err != nil {
    return fmt.Errorf("tun.routes route %q is not a valid CIDR: %v", routeStr, err)
}

Type guard

func isValidCIDR(v any) bool {
    _, err := netip.ParsePrefix(fmt.Sprintf("%v", v))
    return err == nil
}

Prevention

When it happens

Trigger: getAllRoutesFromConfig sees route values like 10.0.0.1 (no /bits), 10.0.0.0/33, hostname strings, or non-string values (lists/maps) interpolated by %v.

Common situations: Using bare host IPs without a prefix length; typos in octets or bits; pasting hostnames instead of CIDRs; YAML types like dates (e.g. 10.0.0.0/08 parsing oddly) or quoted values with whitespace.

Understand the failure class

Related errors


AI-assisted analysis of slackhq/nebula@dd8f660c0a (2026-09-03). Data as JSON: /api/errors/d33df7903a0d6ff2. Report an issue: GitHub.