Skip to content
Latchkey

Helm "nil pointer evaluating interface {}" template error in CI

A template accessed a sub-field of a value that is nil. Helm's Go template engine cannot dereference a missing map or key, so it fails with "nil pointer evaluating interface {}.<field>" and the template path.

What this error means

helm template/install fails with "Error: template: my-app/templates/deployment.yaml:NN:MM: executing ... at <.Values.image.tag>: nil pointer evaluating interface {}.tag".

helm
Error: template: my-app/templates/deployment.yaml:21:18: executing "my-app/templates/
deployment.yaml" at <.Values.image.tag>: nil pointer evaluating interface {}.tag

Common causes

A values key is missing

The template reads .Values.image.tag but image (or image.tag) is not set in values.yaml or the supplied overrides, so the lookup hits nil.

A parent object is nil for some inputs

An optional block is omitted in one environment's values, so its children are nil when the template assumes they exist.

How to fix it

Provide a default in the template

Guard against missing values with default or dig so a missing key yields a fallback instead of nil.

templates/deployment.yaml
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"

Set the missing value

  1. Read the template path in the error to see which key is nil.
  2. Add the key to values.yaml or pass it with --set.
  3. Re-render with helm template to confirm it resolves.
Terminal
helm template my-app ./chart --set image.tag=1.4.2

How to prevent it

  • Define every key the templates read in values.yaml with sensible defaults.
  • Use default/dig/required to make missing values explicit.
  • Run helm template per environment in CI to catch nil paths early.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →