Skip to content
Latchkey

Helm "template: parse error" in CI

Helm renders chart templates with Go templating. A malformed action - an unclosed {{ }}, a bad function call, or a missing end - is a parse error that stops rendering immediately.

What this error means

A helm template/upgrade step fails with "parse error" in a named template file and line, before any Kubernetes object is created.

helm
Error: parse error at (api/templates/deployment.yaml:21): unexpected "}" in
operand

# or:
Error: template: api/templates/_helpers.tpl:8: unclosed action

Common causes

Unbalanced or malformed actions

A missing end, an unclosed {{, or a stray }} breaks the template grammar.

Bad function or pipeline syntax

A misspelled function or an invalid pipeline expression fails to parse.

How to fix it

Render locally to find the exact spot

Use helm template (with lint) to surface the file and line.

Terminal
helm lint ./chart
helm template api ./chart --debug 2>&1 | head -40

Balance actions and fix syntax

  1. Match every if/range/with/define with an end.
  2. Close every {{ with }}.
  3. Correct function names and pipeline expressions.

How to prevent it

  • Run helm lint and helm template in CI before deploy.
  • Keep helper templates small and reviewed.
  • Use an editor with Go-template/Helm awareness.

Related guides

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