{"record":{"id":"03d9f56a654ec26c","repo":"GoogleContainerTools/skaffold","slug":"error-decoding-parsed-yaml-s","errorCode":null,"errorMessage":"error decoding parsed yaml: %s","messagePattern":"error decoding parsed yaml: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/deploy/helm/parse.go","lineNumber":71,"sourceCode":"\t\t\tcontinue\n\t\t}\n\t\tobj, err := parseRuntimeObject(objNamespace, doc)\n\t\tif err != nil {\n\t\t\tlog.Entry(context.TODO()).Infof(\"error parsing object %d from string: %s\", i, err.Error())\n\t\t} else {\n\t\t\tresults = append(results, *obj)\n\t\t\tlog.Entry(context.TODO()).Debugf(\"found deployed object %d: %+v\", i, obj.Obj)\n\t\t}\n\t}\n\n\treturn results\n}\n\nfunc parseRuntimeObject(namespace string, b []byte) (*types.Artifact, error) {\n\td := scheme.Codecs.UniversalDeserializer()\n\tobj, _, err := d.Decode(b, nil, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error decoding parsed yaml: %s\", err.Error())\n\t}\n\treturn &types.Artifact{\n\t\tObj:       obj,\n\t\tNamespace: namespace,\n\t}, nil\n}\n\nfunc getObjectNamespaceIfDefined(doc []byte, ns string) (string, error) {\n\tif i := bytes.Index(doc, []byte(\"apiVersion\")); i >= 0 {\n\t\tmanifests := manifest.ManifestList{doc[i:]}\n\t\tnamespaces, err := manifests.CollectNamespaces()\n\t\tif err != nil {\n\t\t\treturn ns, err\n\t\t}\n\t\tif len(namespaces) > 0 {\n\t\t\treturn namespaces[0], nil\n\t\t}\n\t}","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/deploy/helm/parse.go#L53-L89","documentation":"Skaffold's helm renderer parses rendered YAML and decodes each document into a Kubernetes runtime object via the universal deserializer. If the decoded bytes are not a valid, registered Kubernetes API object (bad apiVersion/kind, malformed manifest, or a non-manifest document like a plain ConfigMap-less YAML), decoding fails and this error wraps the deserializer's message.","triggerScenarios":"A helm template output document that fails scheme.Codecs.UniversalDeserializer().Decode — e.g. helm chart emits YAML with an empty document, a kind/apiVersion the scheme doesn't know, or raw non-Kubernetes YAML (hooks output, NOTES-rendered files).","commonSituations":"Charts emitting CRDs or resources not in the typed scheme; charts with invalid templates producing malformed YAML; helm `--no-hooks` misconfigurations letting hook manifests through; API version drift between chart and installed Kubernetes scheme.","solutions":["Inspect the rendered YAML (skaffold deploy --helm-render or `helm template`) and fix the chart manifest with the bad apiVersion/kind or malformed YAML.","Ensure the chart's resources use apiVersion/kind pairs supported by the Kubernetes scheme (e.g. `apiVersion: v1, kind: List` wrapping needs splitting).","Update skaffold if the resource is a newer builtin type your skaffold's k8s.io libs don't decode.","Filter out non-manifest documents (empty/notes) from the chart output via .helm_files or release config."],"exampleFix":"// before: chart template emits invalid object\nkind: {{ .Values.kind }}\n// after: ensure apiVersion and kind are always rendered together\napiVersion: apps/v1\nkind: {{ .Values.kind | default \"Deployment\" }}","handlingStrategy":"validation","validationCode":"// Validate rendered YAML decodes as a K8s object before deploying\nimport \"sigs.k8s.io/yaml\"\nvar m map[string]interface{}\nif err := yaml.Unmarshal(doc, &m); err != nil {\n    return fmt.Errorf(\"invalid yaml: %w\", err)\n}\nif m[\"apiVersion\"] == nil || m[\"kind\"] == nil {\n    return fmt.Errorf(\"document missing apiVersion/kind: %v\", m)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `helm template` locally in CI to catch invalid rendered manifests before deploy","Ensure every chart template emits both apiVersion and kind","Keep skaffold/k8s.io library versions current with your chart's API versions","Exclude non-manifest documents (NOTES, hooks) from rendered output"],"tags":["kubernetes","yaml","helm","manifest-decoding"],"backgroundTag":"yaml-manifest-decode-failed","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}