{"record":{"id":"7480fdc7aefcf532","repo":"kubernetes/kops","slug":"error-parsing-addons-or-manifest-v","errorCode":null,"errorMessage":"error parsing addons or manifest: %v","messagePattern":"error parsing addons or manifest: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"channels/pkg/channels/addons.go","lineNumber":53,"sourceCode":"\tAPIObject       *api.Addons\n}\n\nfunc LoadAddons(vfsContext *vfs.VFSContext, name string, location *url.URL) (*Addons, error) {\n\tklog.V(2).Infof(\"Loading addons channel from %q\", location)\n\tdata, err := vfsContext.ReadFile(location.String())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading addons from %q: %v\", location, err)\n\t}\n\n\treturn ParseAddons(name, location, data)\n}\n\nfunc ParseAddons(name string, location *url.URL, data []byte) (*Addons, error) {\n\tconfigString := strings.TrimSpace(string(data))\n\n\tobjects, err := kubemanifest.LoadObjectsFrom([]byte(configString))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing addons or manifest: %v\", err)\n\t}\n\n\tapiObject := &api.Addons{}\n\tif len(objects) == 0 {\n\t\t// No objects (empty, whitespace, or comment-only content): nothing to apply.\n\t} else if gvk := objects[0].GroupVersionKind(); gvk.Kind == \"Addons\" && gvk.Group == \"\" && gvk.Version == \"\" {\n\t\t// Reuse the document already parsed by LoadObjectsFrom instead of parsing it again.\n\t\tif err := objects[0].Reparse(apiObject); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error parsing addons: %v\", err)\n\t\t}\n\t} else {\n\t\tmanifest := location.String()\n\t\tmanifestHash, err := utils.HashString(configString)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error hashing manifest: %v\", err)\n\t\t}\n\t\tmanifestLocationHash, err := utils.HashString(manifest)\n\t\tif err != nil {","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/channels/pkg/channels/addons.go#L35-L71","documentation":"ParseAddons wraps failures from kubemanifest.LoadObjectsFrom while converting the addons file into Kubernetes objects. The raw bytes were fetched fine but are not valid YAML/Kubernetes manifests (or a multi-doc stream cannot be decoded).","triggerScenarios":"LoadAddons -> ParseAddons with data that fails LoadObjectsFrom: invalid YAML syntax, tabs in YAML, wrong document structure, binary/HTML content, or a multi-document stream with malformed separators.","commonSituations":"Hand-edited addons channel with YAML indentation mistakes; CI tooling uploaded an HTML error page instead of YAML; Windows line endings/tabs; concatenated manifests missing '---' separators.","solutions":["Run the file through a YAML linter / kubectl apply --dry-run=client to find the syntax error at the reported line.","Fix indentation (spaces not tabs) and document separators ('---').","Restore the original addons channel from upstream if it was hand-modified.","Confirm the URL actually serves raw YAML, not a storage/XML error page."],"exampleFix":"# before (addons.yaml)\nkind: Addons\nmetadata:\n\tname: my-addon   # tab indentation\n# after\nkind: Addons\nmetadata:\n  name: my-addon   # spaces only","handlingStrategy":"validation","validationCode":"// validate before calling ParseAddons\nif err := yaml.Unmarshal(data, &map[string]interface{}{}); err != nil {\n\treturn fmt.Errorf(\"addons file is not valid YAML: %w\", err)\n}\nif bytes.Contains(data, []byte(\"\\t\")) {\n\treturn errors.New(\"addons file contains tab indentation\")\n}","typeGuard":null,"tryCatchPattern":"addons, err := channels.ParseAddons(name, location, data)\nif err != nil {\n\tif strings.Contains(err.Error(), \"error parsing addons or manifest\") {\n\t\t// surface the file for a YAML lint\n\t\tos.WriteFile(\"/tmp/bad-addons.yaml\", data, 0o644)\n\t}\n\treturn err\n}","preventionTips":["Lint channel YAML in CI (yamllint / kubeconform).","Use spaces, never tabs, in manifests.","Serve raw YAML from storage (avoid redirect-to-HTML error pages).","Separate multi-doc manifests with '---'."],"tags":["yaml","parsing","manifest"],"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-12T12:17:11.808Z"}