YAML "found character that cannot start any token" (tabs) in CI
The YAML scanner found a tab character being used to indent a line. Tabs are not permitted for indentation in YAML, so the scanner reports "found character '\t' that cannot start any token".
What this error means
A YAML parse fails with "found character that cannot start any token" (sometimes naming \t) at a line:column that begins with a tab.
yaml: line 4: found character '\t' that cannot start any tokenCommon causes
A tab used for indentation
An editor inserted a literal tab at the start of a line; YAML indentation must be spaces only.
A copy-paste that carried tabs
Content pasted from a tab-indented source (a Makefile, a terminal) brought tab characters into the YAML.
How to fix it
Convert leading tabs to spaces
- Find the tab at the reported line (enable "show whitespace" in your editor).
- Replace leading tabs with two spaces per level.
- Re-parse to confirm the token error clears.
# expand tabs to 2 spaces
expand -t 2 config.yaml > config.fixed.yaml && mv config.fixed.yaml config.yamlBlock tabs in the editor and CI
Set your editor to insert spaces, and let yamllint flag any tab that slips through.
root = true
[*.{yml,yaml}]
indent_style = space
indent_size = 2How to prevent it
- Configure editors to insert spaces, never tabs, for YAML.
- Add an
.editorconfigenforcingindent_style = space. - Run yamllint to catch stray tabs before CI.