Why YAML errors are hard to see
Structure in YAML comes from leading spaces, which are invisible. Two lines that look aligned can differ by one space or by a tab character, and the parser reports an error on or near the line after the real mistake. Click Validate: the editor jumps to the position the parser reports, and the examples below cover the mistakes that cause most errors.
Common YAML errors and how to fix them
The messages are what this validator shows for each case.
Tab used for indentation
Error: tab characters must not be used in indentation
Invalid
a: b: 1
Fixed
a: b: 1
YAML forbids tabs for indentation. Replace them with spaces, and set your editor to insert spaces when you press Tab.
Inconsistent indentation
Error: bad indentation of a mapping entry
Invalid
a: b: 1 c: 2
Fixed
a: b: 1 c: 2
Sibling keys must start in the same column. Line 3 is one space short of the keys above it.
Second colon in a plain value
Error: bad indentation of a mapping entry
Invalid
url: http://example.com title: Note: draft
Fixed
url: http://example.com title: "Note: draft"
A colon followed by a space starts a new key. Put the value in quotes when it contains ": ".
Duplicate key
Error: duplicated mapping key
Invalid
name: a name: b
Fixed
name: b
A key may appear once per mapping. Remove one, or rename it if both were meant to exist.
Unclosed quote or bracket
Error: unexpected end of the stream within a double quoted scalar
Invalid
title: "Release notes version: 2
Fixed
title: "Release notes" version: 2
The string or list was never closed, so the parser read to the end of the file. The error points at the end of the file, so search upward for the quote or bracket that has no partner.