Test files › Structured data › tabs-invalid.yaml

Invalid YAML indented with tabs

YAML indented with tab characters, which the specification forbids.

↓ Download tabs-invalid.yaml
Filenametabs-invalid.yaml
FormatYAML
Size34 bytes (34 bytes)
MIME typeapplication/yaml
SHA-25602941a4076012f35422bd673abd9b834d4f5783934fe9379ca669b00af728681
What this file catchesConfig loaders whose error message just says "unexpected character" without pointing at the tab. A very common source of confusing CI failures.

Handle it in code

Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.

Python

Python has no YAML parser in its standard library, so this is a line check, not a parser. It flags tab indentation, which YAML forbids, and the plain values that PyYAML and other YAML 1.1 loaders silently convert: NO becomes false, 0755 becomes 493, 1.10 becomes 1.1. Quote them.

import re

BOOLS = {"yes", "Yes", "YES", "no", "No", "NO", "on", "On", "ON", "off", "Off", "OFF",
         "true", "True", "TRUE", "false", "False", "FALSE"}

with open("tabs-invalid.yaml", encoding="utf-8") as f:
    for n, line in enumerate(f, 1):
        if re.match(r" *\t", line):
            print(f"line {n}: tab in the indentation, which YAML forbids")
            continue
        m = re.match(r"\s*(?:-\s+|[\w.-]+:\s+)([^\s\"'#][^#]*?)\s*$", line)
        value = m.group(1) if m else ""
        if value in BOOLS:
            print(f"line {n}: {value} is read as a boolean")
        elif re.fullmatch(r"0[0-7]+", value):
            print(f"line {n}: {value} is read as an octal number")
        elif re.fullmatch(r"\d+\.\d*0", value):
            print(f"line {n}: {value} is read as a float and loses its trailing zero")
        elif re.fullmatch(r"\d+(?::[0-5]?\d)+", value):
            print(f"line {n}: {value} is read as a base-60 number")

Run against this file, it prints: line 2: tab in the indentation, which YAML forbids line 3: tab in the indentation, which YAML forbids

Related guides and tools

Sample YAML fileCharacter encodingsVerify its SHA-256

Download & verify

curl -fsSL -o "tabs-invalid.yaml" "https://files.hexaqa.com/yaml/tabs-invalid.yaml"
curl -fsSL "https://files.hexaqa.com/yaml/tabs-invalid.yaml" | sha256sum # expect: 02941a4076012f35422bd673abd9b834d4f5783934fe9379ca669b00af728681

More structured data test files

unclosed-tag.xmlvalid.xmlxxe-file-disclosure.xmlnorway-problem.yaml1000-rows.csv1million-rows.csvbom-and-semicolons.csvformula-injection.csv

← All Structured data files