Article

YAML's "Norway Problem": How a Country Code Broke Config Files

Published 2026-09-14

A real bug with a memorable name

The "Norway Problem" is a genuinely famous YAML quirk: under the older YAML 1.1 specification (still followed by many popular YAML parsers), writing the unquoted country code NO in a list of country codes gets silently interpreted as the boolean value false, not the two-letter string "NO." A configuration file listing country codes could unintentionally turn Norway into a boolean, breaking anything downstream that expected a string.

Why this happens

YAML 1.1 defined a fairly generous list of strings that automatically convert to booleans without needing quotes: not just true/false, but also yes/no, on/off, and their case variations. This was meant to make YAML friendlier to write by hand, but it collides badly with any real-world data that happens to contain those exact words — country codes (NO for Norway), certain product codes, or even just the words "yes" and "no" used as plain text answers in a survey-response file.

YAML 1.2 narrowed this down

The updated YAML 1.2 specification significantly reduced the list of auto-converting boolean words, keeping mainly true/false and dropping most of the yes/no/on/off variants specifically because of problems like this. However, many widely used YAML parsers and libraries (in some cases, for backward compatibility) still implement 1.1-style behavior by default, which is why the Norway Problem remains a real, current-day gotcha rather than purely historical trivia.

The simple fix

Quoting any value that could be ambiguous — "NO" instead of bare NO — forces YAML to treat it as a plain string, sidestepping the auto-conversion entirely. This is why style guides for YAML files often recommend quoting all string values, or at minimum quoting any value that resembles a boolean, a number, or a null keyword.

Check your own YAML

Our YAML Formatter can convert your YAML to JSON, which is a fast way to spot exactly how each value actually got interpreted — if a country code shows up as false in the JSON output, you've found your Norway Problem before it reaches production.

Ready to try it yourself?
Open the YAML Formatter →