{"record":{"id":"f302ff1ba0627ca2","repo":"kubernetes/kops","slug":"failed-to-parse-manifest-w","errorCode":null,"errorMessage":"failed to parse manifest: %w","messagePattern":"failed to parse manifest: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/bootstrapchannelbuilder/pruning.go","lineNumber":87,"sourceCode":"\tpruneGroupKind := make(map[schema.GroupKind]bool)\n\tfor _, gk := range alwaysPruneGroupKinds {\n\t\tpruneGroupKind[gk] = true\n\t}\n\n\t// In addition, we deliberately exclude a few types that are riskier to delete:\n\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] {","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/bootstrapchannelbuilder/pruning.go#L69-L105","documentation":"buildPruneDirectives parses the addon's manifest data with kubemanifest.LoadObjectsFrom to determine namespaces for scoped pruning. If the YAML is not parseable as Kubernetes objects, this error wraps the parse failure.","triggerScenarios":"Normalizing an AddonManifest whose rendered manifest bytes contain invalid YAML, non-object documents, or content that LoadObjectsFrom cannot decode into Kubernetes objects.","commonSituations":"Hand-edited addon manifests with syntax errors; manifests containing plain documents without apiVersion/kind; binary or truncated manifest contents; template placeholders left unrendered.","solutions":["Run the manifest through a YAML/kubectl linter (kubectl apply --dry-run=client) to find the parse error","Fix the YAML syntax at the location reported by the wrapped error","Ensure every document has apiVersion and kind","Re-download the addon manifest from its official channel"],"exampleFix":"// before: document missing kind\napiVersion: v1\nmetadata:\n  name: broken\n// after\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: ok","handlingStrategy":"validation","validationCode":"// Pre-parse the manifest to catch YAML errors before kops does\nif _, err := kubemanifest.LoadObjectsFrom(manifestData); err != nil {\n    return fmt.Errorf(\"addon manifest invalid: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"objects, err := kubemanifest.LoadObjectsFrom(manifestData)\nif err != nil {\n    klog.Errorf(\"fix YAML at reported offset in addon manifest: %v\", err)\n    return err\n}","preventionTips":["Run `kubectl apply --dry-run=client -f` on custom manifests before adding them","Ensure every YAML document has apiVersion and kind","Avoid committing unrendered templates into channels","Keep manifests as plain standard YAML objects"],"tags":["manifest","yaml","parsing","addons","kops"],"backgroundTag":"manifest-parse-failed","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"}