Skip to content

Helm Template Error

Error message

                Error: template: chart/templates/deployment.yaml: error calling include
              

Quick summary

The Helm Chart's Go templates have a syntax error, reference an undefined value, or produce invalid YAML.

Why this happens

  • A template variable is undefined or misspelled

  • Go template syntax error (missing {{ end }}, wrong function name)

  • The values.yaml is missing a required value that the template references

  • The rendered YAML is invalid (wrong indentation, missing fields)

Minimal example

✗ Broken code
# Template references undefined value
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
# values.yaml has no 'image' key
✓ Fixed code
# Add defaults in template
image: {{ .Values.image.repository | default "myapp" }}:{{ .Values.image.tag | default "latest" }}
# Or add to values.yaml:
# image:
#   repository: myapp
#   tag: "1.0"

The template references .Values.image but it is not defined. The fix adds defaults in the template or defines the values.

How to diagnose

  • Run helm template <chart> to render and see the error

  • Use helm lint <chart> to validate the chart

  • Check the template file at the line referenced in the error

  • Verify all required values are provided in values.yaml or via --set

How to fix

  • Fix the Go template syntax (add missing {{ end }}, correct function names)

  • Provide the missing value in values.yaml or via --set

  • Add default values in the template: {{ .Values.foo | default "bar" }}

  • Fix the rendered YAML output to be valid Kubernetes manifest

How to prevent

  • Run helm lint in CI before deploying

  • Use default values in templates to avoid undefined variable errors

  • Test charts with helm template before applying

Related Resources

Related Glossary

← Back to language