Draft
Fix crash on empty helm render: treat no-output chart as no-op#207
Conversation
When helm template --output-dir produces an empty directory (e.g. all templates are gated behind a falsy conditional), ReplaceWithRendered now removes the chart's content dirs and returns successfully with an empty file list instead of crashing with an assertion error. Adds test chart testdata/charts/emptychart and integration test 'empty render no op' to cover this scenario. Closes #206
Copilot
AI
changed the title
[WIP] Fix chartify crash on empty render
Fix crash on empty helm render: treat no-output chart as no-op
Aug 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When all chart templates are gated behind a falsy conditional,
helm template --output-dirproduces an empty directory.ReplaceWithRenderedthen crashed with an opaque assertion error because it expected exactly one subdirectory in the output dir.Changes
replace.go: After readinghelmOutputDirEntries, if the slice is empty, remove the chart's content dirs (templates/,charts/,crds/) so subsequent helm processing also sees no resources, clean up the temp output dir, and returnnil, nil(empty file list, no error). This is a no-op from the caller's perspective.testdata/charts/emptychart/: Minimal test chart with a ConfigMap template fully gated behind{{- if .Values.enabled }}(default:false).integration_test.go: New"empty render no op"integration test exercising this path viaOverrideNamespace(which forcesReplaceWithRenderedto be called).Example
Previously, running chartify against such a chart (with any of
OverrideNamespace,JsonPatches,StrategicMergePatches, orTransformersconfigured) would crash:After this fix, chartify returns successfully with an empty resource list.