kubernetes/kops · error
unhandled type in manifest: %T
Error message
unhandled type in manifest: %T
What it means
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{}).
Source
Thrown at pkg/kubemanifest/visitor.go:122
case []interface{}:
s := data
for i, v := range s {
path = append(path, fmt.Sprintf("[%d]", i))
err := visit(visitor, v, path, func(v interface{}) {
s[i] = v
})
if err != nil {
return err
}
path = path[:len(path)-1]
}
case []string:
// ignore - we don't have any visitors for this currently
default:
return fmt.Errorf("unhandled type in manifest: %T", data)
}
return nil
}
View on GitHub (pinned to 4c8573c808)
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
Example fix
// before m["replicas"] = 3 // after m["replicas"] = float64(3)
Defensive patterns
Strategy: type-guard
Validate before calling
func traversable(v interface{}) bool {
switch v.(type) {
case nil, string, bool, float64, map[string]interface{}, []interface{}, []string:
return true
}
return false
} Type guard
func normalizeNumber(v interface{}) interface{} {
switch n := v.(type) {
case int:
return float64(n)
case int64:
return float64(n)
}
return v
} Try / catch
if err := kubemanifest.Visit(manifest, visitorFn); err != nil {
if strings.Contains(err.Error(), "unhandled type in manifest") {
// normalize inserted Go values to YAML-decoded types and retry
}
return err
} Prevention
- 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
When it happens
Trigger: 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{}.
Common situations: 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{}.
Related errors
- error marshaling %s to yaml: %v
- error unmarshaling subobject %s: %v
- ReadOnlyError
- unexpected kind for cluster, got %T, want kops.Cluster
- method CreateCluster not supported in server-side client
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/f9f1b012ae1b2521.
Report an issue: GitHub.