slackhq/nebula · error

entry %v.mtu in tun.routes is not present

Error message

entry %v.mtu in tun.routes is not present

What it means

A tun.routes entry object is missing the required mtu key. parseRoutes looks up m["mtu"] for each entry and errors when the key is absent. MTU is mandatory because the library installs the route with that interface MTU.

Source

Thrown at overlay/route.go:96

	rawRoutes, ok := r.([]any)
	if !ok {
		return nil, fmt.Errorf("tun.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.routes is invalid", i+1)
		}

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

		mtu, ok := rMtu.(int)
		if !ok {
			mtu, err = strconv.Atoi(rMtu.(string))
			if err != nil {
				return nil, fmt.Errorf("entry %v.mtu in tun.routes is not an integer: %v", i+1, err)
			}
		}

		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)
		}

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Add an mtu key (integer, >= 500) to every tun.routes entry
  2. Check for typos/casing: the key must be exactly mtu
  3. Use the reported entry index to find which object is missing the field
  4. Adopt a config schema/linter that enforces required keys

Example fix

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

Strategy: validation

Validate before calling

for i, e := range routes.([]any) {
    m, _ := e.(map[string]any)
    if _, ok := m["mtu"]; !ok {
        return fmt.Errorf("tun.routes entry %d missing required key mtu", i+1)
    }
}

Prevention

When it happens

Trigger: getAllRoutesFromConfig encounters a route object like {route: 10.0.0.0/24} with no mtu field, or a typo such as mtu_size/MTU.

Common situations: Minimal configs copied from docs that omit mtu; key-name typos or wrong casing; older config formats predating the mtu requirement.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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