{"record":{"id":"e43f636b96af960d","repo":"slackhq/nebula","slug":"invalid-type-t","errorCode":null,"errorMessage":"invalid type: %T","messagePattern":"invalid type: %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"calculated_remote.go","lineNumber":129,"sourceCode":"\t\treturn nil, fmt.Errorf(\"calculated_remotes entry has invalid type: %T\", raw)\n\t}\n\n\tvar l []*calculatedRemote\n\tfor _, e := range rawList {\n\t\tc, err := newCalculatedRemotesEntryFromConfig(cidr, e)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"calculated_remotes entry: %w\", err)\n\t\t}\n\t\tl = append(l, c)\n\t}\n\n\treturn l, nil\n}\n\nfunc newCalculatedRemotesEntryFromConfig(cidr netip.Prefix, raw any) (*calculatedRemote, error) {\n\trawMap, ok := raw.(map[string]any)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"invalid type: %T\", raw)\n\t}\n\n\trawValue := rawMap[\"mask\"]\n\tif rawValue == nil {\n\t\treturn nil, fmt.Errorf(\"missing mask: %v\", rawMap)\n\t}\n\trawMask, ok := rawValue.(string)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"invalid mask (type %T): %v\", rawValue, rawValue)\n\t}\n\tmaskCidr, err := netip.ParsePrefix(rawMask)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid mask: %s\", rawMask)\n\t}\n\n\tvar port int\n\trawValue = rawMap[\"port\"]\n\tif rawValue == nil {","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/slackhq/nebula/blob/dd8f660c0ac37903ec4080ca4d3c861ba9342ceb/calculated_remote.go#L111-L147","documentation":"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.","triggerScenarios":"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.","commonSituations":"Users listing masks directly without mask/port keys, or mis-indented YAML that turns entries into scalars; common when hand-editing nebula configs.","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"],"exampleFix":"// before\nlighthouse:\n  calculated_remotes:\n    10.0.42.0/24:\n      - 10.0.0.0/8\n// after\nlighthouse:\n  calculated_remotes:\n    10.0.42.0/24:\n      - mask: 10.0.0.0/8\n        port: 4242","handlingStrategy":"type-guard","validationCode":"for _, e := range list {\n\tif _, ok := e.(map[string]any); !ok {\n\t\treturn fmt.Errorf(\"each entry must be a mask/port map\")\n\t}\n}","typeGuard":"func isEntryMap(v any) bool {\n\t_, ok := v.(map[string]any)\n\treturn ok\n}","tryCatchPattern":"if err != nil {\n\tif strings.Contains(err.Error(), \"invalid type: \") {\n\t\treturn fmt.Errorf(\"calculated_remotes entries must be objects with mask+port: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["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"],"tags":["nebula","config","type-error","yaml","calculated-remotes"],"backgroundTag":"config-type-mismatch","analyzedSha":"dd8f660c0ac37903ec4080ca4d3c861ba9342ceb","analyzedAt":"2026-09-03T11:13:55.444Z","contentChangedAt":"2026-09-03T11:13:55.444Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}