The five YAML syntax errors behind most failed parses
YAML looks forgiving because it has so little punctuation, and that is exactly why it fails in confusing ways. Whitespace carries the structure, so a mistake you cannot see is still a mistake. These five account for most "my YAML will not parse" reports, and the validator names each one with the line and column where the parser gave up.
- Tabs for indentation. The YAML 1.2.2 specification (section 6.1) allows only spaces for indentation. A tab pasted from a terminal or an editor set to hard tabs gives errors such as "found character that cannot start any token". The tool lists every tab-indented line, not only the first, with tabs drawn as arrows in the excerpt so you can find them.
- Inconsistent indentation. Siblings must begin in exactly the same column and children must be deeper than their parent. Mixing two- and four-space steps is legal in places and fatal in others, so the linter also flags a file that nests by different widths even when it parses.
- Unclosed quotes. A missing closing quote swallows the rest of the file, and the parser only notices at the end. The tool points to the line that opened the quote, not the last line of the file where the parser finally gave up.
- Missing space after the colon.
DEBUG:trueis not a key and a value, it is one plain string. Inside a mapping it triggers "can not read a block mapping entry". The fix hint calls this out when it matches the line. - Unquoted special characters. A value containing
:or#, or starting with@, a backtick,%,*or&, is parsed as syntax rather than text. Wrap the value in quotes.
A parser reports the first structural error and stops, because every later line depends on how that one was read. Fix it, and the tool re-checks as you type. For converting a file that already parses, use the YAML/JSON converter; if the same data is JSON, the JSON validator has the matching rules for that language.