{"record":{"id":"7a8a22c380ca38e6","repo":"kubernetes/kops","slug":"failed-to-get-kind-for-object","errorCode":null,"errorMessage":"failed to get kind for object","messagePattern":"failed to get kind for object","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/bootstrapchannelbuilder/pruning.go","lineNumber":97,"sourceCode":"\tneverPruneGroupKinds := map[schema.GroupKind]bool{\n\t\t{Group: \"\", Kind: \"Namespace\"}:                                    true,\n\t\t{Group: \"apiextensions.k8s.io\", Kind: \"CustomResourceDefinition\"}: true,\n\t}\n\n\t// Parse the manifest; we use this to scope pruning to namespaces\n\tobjects, err := kubemanifest.LoadObjectsFrom(manifestData)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse manifest: %w\", err)\n\t}\n\tobjectsByGK := make(map[schema.GroupKind][]*kubemanifest.Object)\n\tfor _, object := range objects {\n\t\tgv, err := schema.ParseGroupVersion(object.APIVersion())\n\t\tif err != nil || gv.Version == \"\" {\n\t\t\treturn fmt.Errorf(\"failed to parse apiVersion %q\", object.APIVersion())\n\t\t}\n\t\tgvk := gv.WithKind(object.Kind())\n\t\tif gvk.Kind == \"\" {\n\t\t\treturn fmt.Errorf(\"failed to get kind for object\")\n\t\t}\n\n\t\tgk := gvk.GroupKind()\n\t\tobjectsByGK[gk] = append(objectsByGK[gk], object)\n\n\t\t// Warn if there are objects in the manifest that we haven't considered\n\t\tif !pruneGroupKind[gk] {\n\t\t\tif !neverPruneGroupKinds[gk] {\n\t\t\t\tklog.Warningf(\"manifest includes an object of GroupKind %v, which will not be pruned\", gk)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar groupKinds []schema.GroupKind\n\tfor gk := range pruneGroupKind {\n\t\tgroupKinds = append(groupKinds, gk)\n\t}\n","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/bootstrapchannelbuilder/pruning.go#L79-L115","documentation":"Wraps the Kind() lookup failure while grouping manifest objects by GroupKind for pruning. Fires when an object in the addon manifest cannot yield its kind, i.e. malformed object metadata that prevents classifying it for prune scoping.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/bootstrapchannelbuilder/pruning.go:97 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the kind field of the malformed object in the addon manifest","Validate the manifest with kubectl dry-run before applying","Correct or remove the offending manifest and re-run Normalize"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}