kubernetes/kops · error
error serializing addons yaml: %v
Error message
error serializing addons yaml: %v
What it means
AddonManifest.Normalize verifies the addon spec and then serializes the addons object to YAML. This error is returned when utils.YamlMarshal fails on the verified addons object, meaning the in-memory addon channel object cannot be converted to YAML bytes for the manifest resource.
Source
Thrown at upup/pkg/fi/cloudup/bootstrapchannelbuilder/bootstrapchannel.go:74
addonsObject.ObjectMeta.Name = "bootstrap"
for _, manifest := range a.addonManifests {
if manifest.addonSpec == nil {
return fmt.Errorf("addon manifest %q did not have a spec", fi.ValueOf(manifest.Name))
}
if manifest.addonSpec.ManifestHash == "" {
return fmt.Errorf("addon %q manifest hash was not populated", fi.ValueOf(manifest.addonSpec.Name))
}
addonsObject.Spec.Addons = append(addonsObject.Spec.Addons, manifest.addonSpec)
}
if err := addonsObject.Verify(); err != nil {
return err
}
addonsYAML, err := utils.YamlMarshal(addonsObject)
if err != nil {
return fmt.Errorf("error serializing addons yaml: %v", err)
}
a.Contents = fi.NewBytesResource(addonsYAML)
return nil
}
func (a *BootstrapChannel) Find(c *fi.CloudupContext) (*BootstrapChannel, error) {
managedFile := a.toManagedFile()
actual, err := managedFile.Find(c)
if err != nil || actual == nil {
return nil, err
}
a.PublicACL = managedFile.PublicACL
return &BootstrapChannel{
Name: a.Name,
Lifecycle: a.Lifecycle,
Location: a.Location,View on GitHub (pinned to 4c8573c808)
Solutions
- Inspect the wrapped %v error to identify which field failed to marshal
- Remove or fix the offending field in the addon spec (kops edit cluster / addon manifest)
- Upgrade kops to a version where the addons struct serializes correctly
- Rebuild the addon manifest from a known-good channel spec
Example fix
// before: custom addon spec with unsupported field
addon.Spec.Manifest = fi.PtrTo("weird/addon.yaml")
// after: use a supported manifest path and let kops render it
addon.Spec.Manifest = fi.PtrTo("addons/my-addon.yaml") Defensive patterns
Strategy: validation
Validate before calling
// Pre-validate the addon spec marshals cleanly before Normalize
if _, err := utils.YamlMarshal(addonsObject); err != nil {
return fmt.Errorf("addon object not serializable: %w", err)
}
if err := addonsObject.Verify(); err != nil {
return err
} Try / catch
if err := manifest.Normalize(ctx); err != nil {
if strings.Contains(err.Error(), "error serializing addons yaml") {
// inspect wrapped err, fix offending addon spec field
}
return err
} Prevention
- Always call Verify() and fix reported issues before Normalize
- Keep addon specs to schema-defined fields
- Test custom addon channels with a dry-run build before applying
- Pin kops versions between state store writes
When it happens
Trigger: Calling Normalize on an AddonManifest whose Addons object contains a value that cannot be marshaled by the YAML encoder (e.g. an unsupported/invalid field value left in the spec that passes Verify but breaks yaml marshaling).
Common situations: Custom or hand-edited cluster addon specs injected into the channel; a kops upgrade that changed the addons struct so previously-valid data no longer marshals; programmatic construction of AddonManifest tasks in tooling built on kops libraries.
Related errors
- error serializing addons: %v
- unable to marshal YAML: %v
- error converting to yaml: %v
- marshaling to yaml for %v: %w
- error marshaling manifest to yaml: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/d7187ef2e9d86458.
Report an issue: GitHub.