{"record":{"id":"571b26a229b5e320","repo":"kubernetes/kops","slug":"failed-to-parse-apiversion-q-571b26","errorCode":null,"errorMessage":"failed to parse apiVersion %q","messagePattern":"failed to parse apiVersion %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/bootstrapchannelbuilder/pruning.go","lineNumber":93,"sourceCode":"\t//\n\t//  * Namespace: because it deletes anything else that happens to be in the namespace\n\t//\n\t//  * CustomResourceDefinition: because it deletes all instances of the CRD\n\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","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/bootstrapchannelbuilder/pruning.go#L75-L111","documentation":"Wraps schema.ParseGroupVersion failure while parsing a manifest object's apiVersion during prune-directive construction. Fires when the addon manifest being normalized contains an apiVersion that is not a valid 'group/version' string (e.g. missing version).","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/bootstrapchannelbuilder/pruning.go:93 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the apiVersion field in the affected addon manifest","Check for typos such as missing /version segment","Regenerate/re-render the addon after correcting the manifest"],"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-12T07:17:12.445Z"}