Why YAML Breaks at 2am
By toolbelt maintainers ·
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?
Why did "no" become false?
Does formatting lose my comments?
Can it handle multi-document files?
Related tools
- JSON FormatterBeautify, validate, minify, and view JSON. Format messy API responses into readable code or compress it to save bandwidth, running safely in your browser.
- JSON ValidatorValidate JSON syntax with detailed error messages. Catch trailing commas, missing brackets, and syntax errors instantly before sending payloads to your API.
- JSON MinifierCompress JSON to a single line. Remove all unnecessary whitespace and line breaks to reduce payload size for production APIs without altering the underlying data.
- JSON ViewerView JSON in an interactive, collapsible tree structure. Easily navigate massive API responses, expand specific nodes, and inspect deeply nested objects or arrays.