{"record":{"id":"f9f1b012ae1b2521","repo":"kubernetes/kops","slug":"unhandled-type-in-manifest-t","errorCode":null,"errorMessage":"unhandled type in manifest: %T","messagePattern":"unhandled type in manifest: %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/kubemanifest/visitor.go","lineNumber":122,"sourceCode":"\tcase []interface{}:\n\t\ts := data\n\t\tfor i, v := range s {\n\t\t\tpath = append(path, fmt.Sprintf(\"[%d]\", i))\n\n\t\t\terr := visit(visitor, v, path, func(v interface{}) {\n\t\t\t\ts[i] = v\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tpath = path[:len(path)-1]\n\t\t}\n\n\tcase []string:\n\t\t// ignore - we don't have any visitors for this currently\n\n\tdefault:\n\t\treturn fmt.Errorf(\"unhandled type in manifest: %T\", data)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":104,"sourceCodeEnd":127,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/kubemanifest/visitor.go#L104-L127","documentation":"The pkg/kubemanifest visitor walks parsed YAML data and dispatches to VisitString/VisitBool/VisitFloat64/VisitMap. This error fires in visit() when it encounters a Go type in the manifest data that no visitor case handles — any type outside string, bool, float64, nil, map[string]interface{}, []interface{}, and []string (e.g. int, int64, uint64, map[interface{}]interface{}).","triggerScenarios":"Calling visitor traversal (via accept/visit, e.g. through visitor functions over a manifest) on data containing integers or other types not produced by standard YAML decoding into interface{} — typically int values inserted programmatically, or YAML decoded with a different library producing int64/map[interface{}]interface{}.","commonSituations":"Code that inserts Go ints into manifest maps (standard YAML parsing yields float64, but json/yaml-based tooling or manual construction yields int), or YAML v2 parsing of complex keys producing map[interface{}]interface{}.","solutions":["Ensure all numeric values inserted into manifests are float64 (or converted before traversal)","Re-parse the manifest with the kubemanifest YAML loader so values have the expected generic types","Extend the visitor switch to handle the missing type (or convert it) if you control the traversal"],"exampleFix":"// before\nm[\"replicas\"] = 3\n// after\nm[\"replicas\"] = float64(3)","handlingStrategy":"type-guard","validationCode":"func traversable(v interface{}) bool {\n    switch v.(type) {\n    case nil, string, bool, float64, map[string]interface{}, []interface{}, []string:\n        return true\n    }\n    return false\n}","typeGuard":"func normalizeNumber(v interface{}) interface{} {\n    switch n := v.(type) {\n    case int:\n        return float64(n)\n    case int64:\n        return float64(n)\n    }\n    return v\n}","tryCatchPattern":"if err := kubemanifest.Visit(manifest, visitorFn); err != nil {\n    if strings.Contains(err.Error(), \"unhandled type in manifest\") {\n        // normalize inserted Go values to YAML-decoded types and retry\n    }\n    return err\n}","preventionTips":["Always insert float64 (not int) for numbers into manifest maps","Load manifests through the kubemanifest YAML loader rather than other YAML libs","Convert map[interface{}]interface{} to map[string]interface{} after parsing"],"tags":["go","kubemanifest","visitor","type-mismatch"],"backgroundTag":"unhandled-manifest-type","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}