slackhq/nebula · error

entry %v in tun.unsafe_routes is invalid

Error message

entry %v in tun.unsafe_routes is invalid

What it means

Config validation error in parseUnsafeRoutes: the i+1-th element of the tun.unsafe_routes list did not type-assert to map[string]any — it is a scalar or nested list where a mapping of route options was expected.

Source

Thrown at overlay/route.go:170

	r := c.Get("tun.unsafe_routes")
	if r == nil {
		return []Route{}, nil
	}

	rawRoutes, ok := r.([]any)
	if !ok {
		return nil, fmt.Errorf("tun.unsafe_routes is not an array")
	}

	if len(rawRoutes) < 1 {
		return []Route{}, nil
	}

	routes := make([]Route, len(rawRoutes))
	for i, r := range rawRoutes {
		m, ok := r.(map[string]any)
		if !ok {
			return nil, fmt.Errorf("entry %v in tun.unsafe_routes is invalid", i+1)
		}

		var mtu int
		if rMtu, ok := m["mtu"]; ok {
			mtu, ok = rMtu.(int)
			if !ok {
				mtu, err = strconv.Atoi(rMtu.(string))
				if err != nil {
					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"]

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Make each tun.unsafe_routes entry a YAML mapping with keys like route, via, mtu
  2. Remove stray scalars or hyphen-less lines in the list
Defensive patterns

Strategy: validation

When it happens

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