{"record":{"id":"577dfac067baa774","repo":"kubernetes/kops","slug":"error-serializing-addons-v","errorCode":null,"errorMessage":"error serializing addons: %v","messagePattern":"error serializing addons: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/bootstrapchannelbuilder/bootstrapchannelbuilder.go","lineNumber":180,"sourceCode":"\t\t\t\tapplyAdditionalObjectsToCluster = append(applyAdditionalObjectsToCluster, addon)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(applyAdditionalObjectsToCluster) != 0 {\n\t\tkey := \"cluster-addons.kops.k8s.io\"\n\t\tlocation := key + \"/default.yaml\"\n\n\t\taddon := addons.Add(&channelsapi.AddonSpec{\n\t\t\tName:     new(key),\n\t\t\tSelector: map[string]string{\"k8s-addon\": key},\n\t\t\tManifest: new(location),\n\t\t})\n\t\taddon.SkipRemap = true\n\n\t\tmanifestBytes, err := applyAdditionalObjectsToCluster.ToYAML()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error serializing addons: %v\", err)\n\t\t}\n\t\taddon.Source = fi.NewBytesResource(manifestBytes)\n\t\taddon.SkipRender = true\n\t}\n\n\tpreRegisterAddonImages := b.shouldPreRegisterAddonImages()\n\n\tvar addonTasks []*AddonManifest\n\tfor _, addon := range addons.Items {\n\t\tif preRegisterAddonImages {\n\t\t\tif err := addon.CollectImages(b.assetBuilder, b.addonRenderer); err != nil {\n\t\t\t\tklog.Warningf(\"unable to pre-register addon images for %q: %v\", addonKey(addon.Spec), err)\n\t\t\t}\n\t\t}\n\n\t\ttask := &AddonManifest{\n\t\t\tName:      new(b.Cluster.ObjectMeta.Name + \"-addons-\" + addonKey(addon.Spec)),\n\t\t\tLifecycle: b.Lifecycle,","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/bootstrapchannelbuilder/bootstrapchannelbuilder.go#L162-L198","documentation":"For addons of type 'additionalObjects', Build creates an in-memory manifest location and serializes the objects to YAML via ToYAML(). This error is returned if that serialization fails, blocking generation of the addon source bytes.","triggerScenarios":"Building a cluster whose spec.addons include an addon with additionalObjects (or additionalObjects addons provided externally) where one of the embedded Kubernetes objects cannot be converted to YAML by applyAdditionalObjectsToCluster.ToYAML().","commonSituations":"additionalObjects entries with fields that fail YAML/JSON marshaling (e.g. raw nested values from a hand-written channel); version skew between kops and the addon channel format.","solutions":["Inspect the wrapped %v error to find the failing object/field","Fix or regenerate the additionalObjects in the addon channel manifest","Remove the addon entry if the objects are no longer needed","Upgrade kops/addon channel to compatible versions"],"exampleFix":"// before (channel yaml)\nadditionalObjects:\n- apiVersion: v1\n  kind: ConfigMap\n  unknownField: <custom type>\n// after: only standard serializable objects\nadditionalObjects:\n- apiVersion: v1\n  kind: ConfigMap\n  metadata:\n    name: my-config","handlingStrategy":"validation","validationCode":"// Validate additionalObjects decode as Kubernetes objects first\nfor _, obj := range addon.Spec.AdditionalObjects {\n    if obj.APIVersion == \"\" || obj.Kind == \"\" {\n        return fmt.Errorf(\"additionalObject %v missing apiVersion/kind\", obj)\n    }\n}","typeGuard":null,"tryCatchPattern":"yamlBytes, err := applyAdditionalObjectsToCluster.ToYAML()\nif err != nil {\n    return fmt.Errorf(\"cannot serialize additionalObjects addon: %w\", err)\n}","preventionTips":["Only include standard serializable Kubernetes objects in additionalObjects","Regenerate channels with current kops tooling","Dry-run `kops update cluster --dry-run` to surface serialization issues early"],"tags":["addons","yaml","serialization","kops"],"backgroundTag":"yaml-serialization-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"}