{"record":{"id":"6d41aa61128ebc57","repo":"helm/helm","slug":"error-while-parsing-post-rendered-output-w","errorCode":null,"errorMessage":"error while parsing post rendered output: %w","messagePattern":"error while parsing post rendered output: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/action/action.go","lineNumber":455,"sourceCode":"\t\t\t// Here, we merge the documents into a stream, post-render them, and then split\n\t\t\t// them back into a map of filename -> content.\n\n\t\t\t// Merge files as stream of documents for sending to post renderer\n\t\t\tmerged, err := annotateAndMerge(files)\n\t\t\tif err != nil {\n\t\t\t\treturn hs, b, notes, fmt.Errorf(\"error merging manifests: %w\", err)\n\t\t\t}\n\n\t\t\t// Run the post renderer\n\t\t\tpostRendered, err := pr.Run(bytes.NewBufferString(merged))\n\t\t\tif err != nil {\n\t\t\t\treturn hs, b, notes, fmt.Errorf(\"error while running post render on files: %w\", err)\n\t\t\t}\n\n\t\t\t// Use the file list and contents received from the post renderer\n\t\t\tfiles, err = splitAndDeannotate(postRendered.String(), \"\")\n\t\t\tif err != nil {\n\t\t\t\treturn hs, b, notes, fmt.Errorf(\"error while parsing post rendered output: %w\", err)\n\t\t\t}\n\t\tdefault:\n\t\t\treturn hs, b, notes, fmt.Errorf(\"unknown post-render strategy: '%s'\", postRenderStrategy)\n\t\t}\n\t}\n\n\t// Sort hooks, manifests, and partials. Only hooks and manifests are returned,\n\t// as partials are not used after renderer.Render. Empty manifests are also\n\t// removed here.\n\ths, manifests, err := releaseutil.SortManifests(files, nil, releaseutil.InstallOrder)\n\tif err != nil {\n\t\t// By catching parse errors here, we can prevent bogus releases from going\n\t\t// to Kubernetes.\n\t\t//\n\t\t// We return the files as a big blob of data to help the user debug parser\n\t\t// errors.\n\t\tfor name, content := range files {\n\t\t\tif strings.TrimSpace(content) == \"\" {","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/helm/helm/blob/2a29f1770b62844b27197d2507377361d45ad7c0/pkg/action/action.go#L437-L473","documentation":"The final stage of the combined strategy: the single post-renderer run succeeded as a process, but splitAndDeannotate cannot parse its stdout back into a file map (unparseable YAML, non-mapping documents, or annotation/rewrite failures). This error distinguishes bad renderer output from a renderer execution failure (the previous check).","triggerScenarios":"A post-renderer whose stdout mixes non-YAML content with manifests — log lines, banners, partial output before a crash caught late — or emits documents that are not mappings, under the default combined strategy.","commonSituations":"Custom scripts printing to stdout instead of stderr; tools that prepend human-readable summaries; a renderer that dies mid-write without a non-zero exit; output encoding problems.","solutions":["Capture and inspect the renderer output: helm template ./mychart | ./render.sh | tee out.yaml, then yq eval-all out.yaml","Move every non-YAML line in the renderer to stderr","Guarantee stdout is flushed and complete, and exit non-zero on internal errors","Ensure each document in the output is a mapping-shaped manifest"],"exampleFix":"# before: renderer prints a banner on stdout\nprintf 'kustomize wrapper v2\\n'\nkustomize file stdout\n\n# after: banner on stderr, stdout stays pure YAML\nprintf 'kustomize wrapper v2\\n' >&2\nkustomize file stdout","handlingStrategy":"validation","validationCode":"// golden contract test: renderer stdout must parse and contain only mapping docs\nout := runRendererOverSample()\ndocs, err := kio.ParseAll(out)\nif err != nil {\n\tlog.Fatalf(\"renderer output unparseable: %v\", err)\n}\nfor i, d := range docs {\n\tif d.YNode().Kind != yaml.MappingNode {\n\t\tlog.Fatalf(\"renderer output doc %d is not a mapping\", i)\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"error while parsing post rendered output\") {\n\t// renderer stdout polluted: capture it (helm template | ./render.sh | tee), clean logging, retry\n}","preventionTips":["Keep stdout of the renderer pure YAML; route all logs to stderr","Flush stdout fully and exit non-zero on internal failure","Assert parseability of renderer output in CI with yq/kio"],"tags":["yaml","post-render","stdout"],"backgroundTag":null,"analyzedSha":"2a29f1770b62844b27197d2507377361d45ad7c0","analyzedAt":"2026-08-15T22:02:47.490Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}