How the validator works
The validator reads your YAML with a full YAML 1.2 parser and reports everything that is wrong, with the line and the column. It shows the lines around each error and a caret under the place where the parser got stuck. Because one mistake can confuse the parser for the lines after it, fix the first error and check again.
The most common errors
| Error | Cause | Fix |
|---|---|---|
| Tabs in indentation | A tab character was used to indent a line | Use spaces. Set your editor to insert spaces for the Tab key. |
| Bad indentation of a mapping entry | A key is indented by a different amount than its neighbors | Align the keys at the same level with the same number of spaces. |
| Nested mappings are not allowed in compact mappings | Something like a: b: c on one line | Put the inner key on its own indented line. |
| Map keys must be unique | The same key appears twice in one mapping | Remove or rename one of them. |
| Missing closing quote or bracket | A string, list or mapping was opened and not closed | Add the closing " or ] or }. |
| A colon in a plain value | A value such as time: 12:30 or a: b: c | Put the value in quotes. |
| Unresolved alias | An alias *name has no anchor &name before it | Define the anchor first, or fix the name. |
Warnings and notes
A file can be valid and still not mean what you think. After the errors, the validator lists notes about values that different tools read in different ways:
- yes, no, on, off, y and n. They are text in YAML 1.2 but booleans for parsers that follow YAML 1.1, which is the case for many older tools. The country code NO becoming false is the best known example.
- Leading zeros such as 0755. YAML 1.2 reads this as the decimal number 755, but YAML 1.1 reads it as an octal number.
- Trailing zeros in a version such as 1.10, which is read as the number 1.1.
- Very large numbers that some tools cannot store exactly.
- Trailing spaces at the end of lines.
Options
- YAML version: 1.2 is the current standard. Choose 1.1 to see how an older parser would read the file, for example with yes and no as booleans.
- Allow duplicate keys: by default a repeated key is an error, because most tools keep only one of the values and silently lose the other.
What it does not check
The validator checks YAML syntax only. It does not know whether your file is a valid Kubernetes manifest, a Docker Compose file or a GitHub Actions workflow. For that you need the schema of the tool that reads the file. Your YAML is processed in your browser and never uploaded.
Once your file is valid, tidy it with the YAML formatter, or convert it with YAML to JSON. The YAML syntax guide explains the rules.