Skip to content
toolbelt
Back to Guides

Why YAML Breaks at 2am

By ·

Updated

YAML is pleasant until it is not. A tab, a stray colon, or an inconsistent indent will take your pipeline down. Here is how to find it fast.

What is this tool?

YAML expresses nested data with indentation rather than brackets. It is lovely to read and unforgiving to edit.

How it works

I parse the document with a YAML library that tracks positions, so a failure points at a line rather than merely saying "invalid". If it parses, formatting re-prints it with consistent indentation and quoting.

Example

This breaks:
service:
	name: api

Error: line 2 — tabs are not allowed for indentation.

This works:
service:
  name: api

When to use it

Before pushing a Kubernetes manifest, a CI config, or anything a pipeline depends on. Especially after editing on a phone or pasting from a chat window, both of which love to introduce tabs.

Optimization Tips

The three failures that account for most YAML bugs: a tab instead of spaces, a missing space after a colon, and an unquoted value like `yes` becoming a boolean. Quote anything that could be misread.

Frequently Asked Questions

Why can I not use tabs?
The YAML spec forbids tabs for indentation. Your editor will happily insert them anyway.
Why did "no" become false?
YAML 1.1 treats yes/no/on/off as booleans. Quote it if you meant the string.
Does formatting lose my comments?
No, comments are preserved by the formatter. They are lost if you convert to JSON.
Can it handle multi-document files?
Yes, documents separated by --- are handled.

Ready to try it out?

Put this knowledge into practice with our free tool.

Go to Tool

Related tools