Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Servers, nginx and Docker

A Helm template fails on a nested value whose parent does not exist

Your error

Error: template: mychart/templates/secret.yaml:7:28: executing "mychart/templates/secret.yaml" at <.Values.certificate.overwrite>: nil pointer evaluating interface {}.overwrite1 more line it can show

Fix it fast

Most common cause, 1 of 3

The parent map is not in the values at all

Add the parent map to the values file you pass, at the level the template expects.

Fix
# my-values.yaml
certificate:
  overwrite: false
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

nil pointer evaluating interface {}.overwrite means a Helm template read a nested value such as .Values.certificate.overwrite while certificate itself was missing or null, so Go's template engine had nothing to look inside. Add the parent map to your values, stop overriding it with null, or guard the template with a with block. Helm 4.3 and 3.22.

  • Applies to Helm 4.3.2, Helm 3.22.1, Argo CD 3.6 Helm sources
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

The part inside <...> is the full path the template tried to read, and the word after interface {}. is the key that failed. Render the chart with the same values and print what Helm actually computed for the parent key.

Run this first
helm template test ./mychart -f my-values.yaml --debug > /dev/null
helm show values ./mychart | grep -n -A3 "^certificate:"

Then find the line you see in this list and open its fix:

  1. 1The parent map is not in the values at allhelm show values has no certificate: block, and your own file has none either, or it sits under another key because of indentation
  2. 2An override set the parent to nullYour file has certificate: with nothing under it (or only comments), or a --set certificate=null flag
  3. 3Argo CD never passed your values filehelm template works on your machine with -f, but the Argo CD application fails, and its spec sets ignoreMissingValueFiles: true

What does the error look like?

  • Error: template: mychart/templates/secret.yaml:7:28: executing "mychart/templates/secret.yaml" at <.Values.certificate.overwrite>: nil pointer evaluating interface {}.overwrite
  • nil pointer evaluating interface {}.overwrite

Cause 1 of 3

The parent map is not in the values at all

You seehelm show values has no certificate: block, and your own file has none either, or it sits under another key because of indentation

Check

Go's text/template raises nil pointer evaluating interface {}.overwrite when it has to read a field from a nil interface value. When .Values.certificate is absent, there is no map to read overwrite from, and rendering stops with this message.

Check
helm show values ./mychart | grep -n "certificate"

Fix

Add the parent map to the values file you pass, at the level the template expects. If you maintain the chart, also give it a default in the chart's own values.yaml.

Fix
# my-values.yaml
certificate:
  overwrite: false

Verify

The chart renders and the manifest shows the value.

Verify
helm template test ./mychart -f my-values.yaml | grep -n overwrite

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 3

An override set the parent to null

You seeYour file has certificate: with nothing under it (or only comments), or a --set certificate=null flag

Check

Helm documents that overriding a key with null removes it from the merged values. YAML resolves a key with empty content to null, so certificate: with nothing under it wipes the chart's default map and the nested read fails.

Check
grep -n -A2 "^certificate:" my-values.yaml

Fix

Delete the empty key so the chart default survives, or fill it with the fields you want. Use null only for keys you really mean to remove.

Fix
# before: wipes the chart's default map
certificate:
# after: keep it and change one field
certificate:
  overwrite: true

Verify

Rendering with the corrected file succeeds.

Verify
helm template test ./mychart -f my-values.yaml > /dev/null && echo rendered

Confirmed by helm.sh

Did this fix it?

Cause 3 of 3

Argo CD never passed your values file

You seehelm template works on your machine with -f, but the Argo CD application fails, and its spec sets ignoreMissingValueFiles: true

Check

Argo CD resolves valueFiles relative to the chart's root directory. With ignoreMissingValueFiles turned on, a file at the wrong path is skipped without an error, so the chart renders with defaults only and the nested key is missing again.

Check
kubectl -n argocd get application my-app -o jsonpath='{.spec.source.path}{"\n"}{.spec.source.helm.valueFiles}{"\n"}'

Fix

Correct the path so it is relative to the chart folder (or use a multi-source Application for files in another repository), and leave ignoreMissingValueFiles off until the path is proven.

Fix
source:
  path: charts/mychart
  helm:
    valueFiles:
      - values-production.yaml

Verify

After a refresh the application shows no ComparisonError and its manifests carry your values.

Verify
argocd app get my-app --refresh

Confirmed by argo-cd.readthedocs.io

Did this fix it?

How do I stop it coming back?

  • In charts you own, wrap optional nested blocks in with, which runs only when the parent value is not empty.
  • Ship a default for every map a template reads, even if it is an empty map, in the chart's values.yaml.
  • Run helm template with the production values file in CI before Argo CD ever syncs it.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.