slackhq/nebula · error
invalid type: %T
Error message
invalid type: %T
What it means
Each entry within a calculated_remotes list must be a map (map[string]any) containing at least `mask` and `port` keys. newCalculatedRemotesEntryFromConfig throws this when an element of the list is any other type — e.g. a bare string, number, or nested list.
Source
Thrown at calculated_remote.go:129
return nil, fmt.Errorf("calculated_remotes entry has invalid type: %T", raw)
}
var l []*calculatedRemote
for _, e := range rawList {
c, err := newCalculatedRemotesEntryFromConfig(cidr, e)
if err != nil {
return nil, fmt.Errorf("calculated_remotes entry: %w", err)
}
l = append(l, c)
}
return l, nil
}
func newCalculatedRemotesEntryFromConfig(cidr netip.Prefix, raw any) (*calculatedRemote, error) {
rawMap, ok := raw.(map[string]any)
if !ok {
return nil, fmt.Errorf("invalid type: %T", raw)
}
rawValue := rawMap["mask"]
if rawValue == nil {
return nil, fmt.Errorf("missing mask: %v", rawMap)
}
rawMask, ok := rawValue.(string)
if !ok {
return nil, fmt.Errorf("invalid mask (type %T): %v", rawValue, rawValue)
}
maskCidr, err := netip.ParsePrefix(rawMask)
if err != nil {
return nil, fmt.Errorf("invalid mask: %s", rawMask)
}
var port int
rawValue = rawMap["port"]
if rawValue == nil {View on GitHub (pinned to dd8f660c0a)
Solutions
- Restructure each list element as a map with `mask` and `port` keys
- Check the %T in the message to see what the element parsed as (string, float64, etc.)
- Fix YAML indentation so each entry is a mapping under the CIDR's list
Example fix
// before
lighthouse:
calculated_remotes:
10.0.42.0/24:
- 10.0.0.0/8
// after
lighthouse:
calculated_remotes:
10.0.42.0/24:
- mask: 10.0.0.0/8
port: 4242 Defensive patterns
Strategy: type-guard
Validate before calling
for _, e := range list {
if _, ok := e.(map[string]any); !ok {
return fmt.Errorf("each entry must be a mask/port map")
}
} Type guard
func isEntryMap(v any) bool {
_, ok := v.(map[string]any)
return ok
} Try / catch
if err != nil {
if strings.Contains(err.Error(), "invalid type: ") {
return fmt.Errorf("calculated_remotes entries must be objects with mask+port: %w", err)
}
return err
} Prevention
- Never put bare CIDR strings in the entry list; always use mask:/port: maps
- Check YAML indentation so entries don't collapse into scalars or nested lists
- Document the entry schema (map with mask and port) in your config templates
When it happens
Trigger: A calculated_remotes list element like `- 10.0.0.0/8` (bare string instead of a mask/port map), or a list nested inside a list from bad YAML indentation.
Common situations: Users listing masks directly without mask/port keys, or mis-indented YAML that turns entries into scalars; common when hand-editing nebula configs.
Related errors
- config `%s` has invalid type: %T
- calculated_remotes entry has invalid type: %T
- invalid mask (type %T): %v
- config `%s` has invalid type: %T
- invalid mask: %s for cidr: %s
AI-assisted analysis of slackhq/nebula@dd8f660c0a (2026-09-03).
Data as JSON: /api/errors/e43f636b96af960d.
Report an issue: GitHub.