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.
error converting YAML to JSONdid not find expected keymapping values are not allowed in this contextfound character that cannot start any tokenerror parsing 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
- cannot re-use a name that is still in use Error: INSTALLATION FAILED: cannot re-use a name that is still in use
- FailedCreatePodSandBox Failed to create pod sandbox: plugin type="calico" failed (add): ... (FailedCreatePodSandBox)
- provided port is not in the valid range spec.ports[0].nodePort: Invalid value: 80: provided port is not in the valid range. The range of valid ports is 30000-32767
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 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.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 14 Oct 2026