Common causes
1. Country and language codes
NO (Norway) is the famous case, but ON (Ontario) and Y/N flags hit the same rule. Quote codes and short flags.
countries:
- GB
- SE
- NOcountries:
- GB
- SE
- "NO"2. yes/no and on/off answers meant as text
A setting such as mode: off reaches a 1.1 parser as false, which the application may treat very differently from the string “off”. Quote it, or use a real boolean if a boolean is what the program expects.
debug: off
answer: yesdebug: "off"
answer: "yes"3. Kubernetes environment variable values
Container env values must be strings. value: yes or value: true is parsed as a boolean and kubectl rejects the manifest with “cannot unmarshal bool into Go struct field”.
env:
- name: FEATURE_X
value: yesenv:
- name: FEATURE_X
value: "yes"4. The GitHub Actions on: key
GitHub reads workflows correctly, but if you load a workflow with PyYAML the top-level on: key becomes the boolean True. Quote it when processing workflows with YAML 1.1 tools.
on:
push:
branches: [main]"on":
push:
branches: [main]5. Numbers that are not what they seem
The same implicit typing turns version: 1.10 into the float 1.1, mode: 0755 into an octal number in 1.1, and 22:30 into 1350 (base-60) in 1.1. Quote anything that is an identifier rather than a quantity.
version: 1.10
mode: 0755
start: 22:30version: "1.10"
mode: "0755"
start: "22:30"Frequently asked questions
Which parsers still use YAML 1.1 rules?
PyYAML, Ruby Psych, Go’s gopkg.in/yaml.v2 and SnakeYAML 1.x apply 1.1 booleans. ruamel.yaml, the JavaScript yaml package and Go’s yaml.v3 default to 1.2, where only true and false are booleans.
Does quoting change the value for 1.2 parsers?
No. In YAML 1.2, NO and “NO” are both the string NO, so quoting is harmless there and protective everywhere else.
Can PasteKit parse as YAML 1.1?
Yes. Switch the YAML version option to 1.1 and the Tree view and conversions show the values as a 1.1 parser would, with a warning on each implicit boolean.