error converting YAML to JSON: yaml: line 12: did not find expected key
The manifest isn’t valid YAML — usually indentation, a tab character, or an unquoted special character.
Seen on:
Kubernetes
Meaning
kubectl parses YAML before talking to the cluster. “did not find expected key”, “mapping values are not allowed in this context” and “found character that cannot start any token” all point at the reported line (or the one before it). Tabs are never allowed for indentation.
Common causes
- Mixed or inconsistent indentation
- Tab characters
- Unquoted values containing ': ' or starting with @, *, {, %
- Helm template producing broken indentation (missing nindent)
⚡ Quick fix
- Check the reported line and the line above
- Replace tabs with spaces
- Quote strings with special characters
- Lint: yamllint file.yaml / helm template | kubectl apply --dry-run=client -f -
Detailed fix by platform
Shell
- bash
yamllint deploy.yaml grep -nP '\t' deploy.yaml
How to diagnose
- Line — Reported line ±1
- Tabs — Any tab characters?
- Template — Rendered output valid?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Kubernetes
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026