Cryonel

YAML Bad Indentation Error, Explained

Unlike JSON, YAML uses whitespace itself to express structure — so indentation isn't cosmetic, it's syntax. A single misplaced space breaks parsing.

What triggers it

How to fix it

Configure your editor to insert spaces, not tabs, on Enter/Tab (most YAML-aware editors do this by default when they detect a .yml/.yaml extension). Pick one indent width (2 spaces is the near-universal convention) and stick to it throughout the file. When in doubt about a value containing a colon, quote it.

If you just need to convert between formats rather than hand-write YAML, the JSON ⇄ YAML Converter lets you build the structure as JSON — where indentation is not significant — and get valid YAML out.

Related Tools