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
- Provide a valid CIDR prefix such as 10.0.0.0/24 (IP + /prefix-length)
- Validate the CIDR with netip.ParsePrefix in a scratch script or an online CIDR checker before committing
- Remove whitespace/quotes issues around the value
- 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
- Always include a prefix length: 10.0.0.0/24, not 10.0.0.1
- Validate CIDRs with netip.ParsePrefix or a linter before deploying
- Avoid hostnames and whitespace in route values
- Check prefix-length bounds (0-32 for IPv4, 0-128 for IPv6)
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
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- config `%s` has invalid CIDR: %s. %w
- config `%s` has invalid CIDR: %s
- Empty configuration
- group should contain a single value, an array with more than
- stats.host can not be empty
AI-assisted analysis of slackhq/nebula@dd8f660c0a (2026-09-03).
Data as JSON: /api/errors/d33df7903a0d6ff2.
Report an issue: GitHub.