Common YAML Errors & How to Fix Them

The error messages you actually see, what they mean, and the one-line fix for each.

Paste your YAML into the YAML Validator for a precise line/column report — YAML Validator →

"mapping values are not allowed here"

YAML hit a colon (:) where it expected a key. Two causes dominate:

"did not find expected key" / "expected "

This is almost always indentation. A child line is not indented further than its parent, so YAML cannot place it in the mapping.

# Bad
config:
debug: true

# Good
config:
  debug: true

"found character '\\t' that cannot start any token"

The YAML spec forbids tabs for indentation. A pasted tab is invisible but breaks parsing. Replace tabs with spaces — 2 per level is the common convention.

Duplicate keys

Declaring the same key twice in one mapping is invalid. Some parsers take the last value silently; others throw. Remove the duplicate or rename one.

# Bad
title: First
title: Second

# Good
title: First
subtitle: Second

Boolean and number coercion

Unquoted yes, no, on, off become booleans, and values like 007 become numbers. If you mean the literal string, quote it: version: "007".

Find and fix them fast

Paste your YAML into the YAML Validator for a precise line/column report. For front matter, the Frontmatter Validator & Fixer goes further — it auto-repairs the common mistakes above and shows exactly what changed.

Related guides