Direct answer

The template rendered successfully as text, but the generated document is not valid YAML. Inspect the rendered output around the reported line.

Where this error appears

Helm template and install

Root cause

Common causes are incorrect nindent depth, aggressive {{- whitespace trimming, an unquoted colon, or a conditional that leaves an incomplete key.

Minimal reproduction

metadata:
  labels:
  {{- toYaml .Values.labels | nindent 2 }}

Corrected example

metadata:
  labels:
{{ toYaml .Values.labels | nindent 4 }}

Verify the fix

helm template demo ./chart --debug > rendered.yaml

Things to check

  • The reported line is often in rendered YAML, not the original template.
  • Render the smallest failing template first.

Authoritative reference

Confirm version-specific behavior in Debugging templates