Skip to content
Latchkey

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
yaml: line 4: found character '\t' that cannot start any token

Common 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

  1. Find the tab at the reported line (enable "show whitespace" in your editor).
  2. Replace leading tabs with two spaces per level.
  3. Re-parse to confirm the token error clears.
Terminal
# expand tabs to 2 spaces
expand -t 2 config.yaml > config.fixed.yaml && mv config.fixed.yaml config.yaml

Block tabs in the editor and CI

Set your editor to insert spaces, and let yamllint flag any tab that slips through.

.editorconfig
root = true
[*.{yml,yaml}]
indent_style = space
indent_size = 2

How to prevent it

  • Configure editors to insert spaces, never tabs, for YAML.
  • Add an .editorconfig enforcing indent_style = space.
  • Run yamllint to catch stray tabs before CI.

Frequently asked questions

What causes ""found character that cannot start any token""?
An editor inserted a literal tab at the start of a line; YAML indentation must be spaces only.
How do I fix "found character that cannot start any token"?
Convert leading tabs to spaces

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card