{"record":{"id":"d4718ef72de4831a","repo":"kubernetes/kops","slug":"error-remapping-manifest-s-v-d4718e","errorCode":null,"errorMessage":"error remapping manifest %s: %v","messagePattern":"error remapping manifest (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/bootstrapchannelbuilder/addonmanifest.go","lineNumber":100,"sourceCode":"\t}\n\n\tmanifestBytes, err := fi.ResourceAsBytes(a.source)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error reading addon %q manifest: %v\", fi.ValueOf(a.Name), err)\n\t}\n\n\tif !a.skipRender && a.addonRenderer != nil {\n\t\tmanifestBytes, err = a.addonRenderer.RenderTemplate(fi.ValueOf(a.Location), manifestBytes, tasksVisibleToAddons(c.AllTasks()))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error rendering addon %q template: %w\", fi.ValueOf(a.Name), err)\n\t\t}\n\t}\n\n\tif !a.skipRemap {\n\t\tmanifestBytes, err = addonmanifests.RemapAddonManifest(a.addonSpec, a.modelContext, a.assetBuilder, manifestBytes, a.serviceAccounts)\n\t\tif err != nil {\n\t\t\tklog.Infof(\"invalid manifest: %s\", string(manifestBytes))\n\t\t\treturn fmt.Errorf(\"error remapping manifest %s: %v\", fi.ValueOf(a.Location), err)\n\t\t}\n\t}\n\n\tmanifestBytes = []byte(strings.TrimSpace(string(manifestBytes)))\n\n\tif a.buildPrune {\n\t\tif err := buildPruneDirectives(a.addonSpec, manifestBytes); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to configure pruning for %s: %w\", fi.ValueOf(a.addonSpec.Name), err)\n\t\t}\n\t}\n\n\trawManifest := string(manifestBytes)\n\tmanifestHash, err := utils.HashString(rawManifest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error hashing manifest: %v\", err)\n\t}\n\ta.addonSpec.ManifestHash = manifestHash\n\ta.Contents = fi.NewBytesResource(manifestBytes)","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/bootstrapchannelbuilder/addonmanifest.go#L82-L118","documentation":"With rendering done, Normalize calls addonmanifests.RemapAddonManifest to rewrite the manifest (image assets, service accounts, cluster references). On failure it logs the offending manifest bytes via klog and returns this error containing the addon location and the underlying cause. Remapping failing usually means the manifest YAML is not a valid/parseable addon manifest or references things that cannot be rewritten.","triggerScenarios":"Normalize runs with skipRemap=false and RemapAddonManifest returns an error while processing manifestBytes for the addon at fi.ValueOf(a.Location) — e.g. invalid YAML, an unmarshalable field, or missing metadata the remapper requires.","commonSituations":"A custom addon manifest that is not valid multi-document YAML or lacks required ObjectMeta; an addon manifest using fields the current kOps remapper cannot handle; a kOps upgrade changing RemapAddonManifest expectations; corrupted manifest bytes from an earlier (silently mangled) render step.","solutions":["Inspect the 'invalid manifest: ...' log line immediately preceding the error to see the exact bytes kOps tried to remap","Validate the manifest YAML parses (yamllint / kubectl apply --dry-run) and fix syntax or missing metadata","Check the inner error from RemapAddonManifest in the message and fix the referenced resource (e.g. missing image, bad service account reference)","If a kOps upgrade caused it, update the addon manifest to the format expected by your kOps version or set skipRemap only if you truly manage assets yourself"],"exampleFix":"// before (manifest missing apiVersion/kind)\nmetadata:\n  name: my-addon\n// after\napiVersion: v1\nkind: Deployment\nmetadata:\n  name: my-addon","handlingStrategy":"try-catch","validationCode":"// validate the manifest parses before normalization\nif err := yaml.Unmarshal(manifestBytes, &map[string]interface{}{}); err != nil {\n    return fmt.Errorf(\"addon %s manifest is not valid YAML: %w\", addonName, err)\n}","typeGuard":null,"tryCatchPattern":"if err := m.Normalize(ctx); err != nil && strings.Contains(err.Error(), \"error remapping manifest\") {\n    // klog already printed the offending bytes; parse/fix them, then retry\n    log.Printf(\"remap failed: %v\", err)\n}","preventionTips":["Validate custom addon manifests with yamllint/kubectl --dry-run before adding to a channel","Keep manifests in the standard kOps addon format (apiVersion/kind/metadata on every document)","After kOps upgrades, re-run update on a test cluster to catch remapper format changes"],"tags":["addons","manifest","yaml","bootstrap-channel"],"backgroundTag":"manifest-remap-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"}