Quick answer
The parser encountered a character or token it did not expect at the current position.
YAML Unexpected Character
The parser encountered a character or token it did not expect at the current position. This often means a typo, wrong character, or encoding issue.
Common causes
- Tab character where only spaces are allowed (e.g. in indentation).
- Invalid UTF-8 or control characters in the file.
- Stray or misplaced character (e.g. extra colon, bracket, or comma).
How to fix
- Replace tabs with spaces if your parser does not allow tabs.
- Ensure the file is valid UTF-8 and has no control characters.
- Use a YAML validator to get the exact line and column of the error.
Examples
Bad
name: value: 1
Good
name: value: 1
FAQ
- What encoding should YAML use?
- YAML files should be UTF-8. Some parsers support UTF-16; avoid other encodings without a BOM or declaration.
- Why does YAML say unexpected tab?
- Many parsers disallow tabs for indentation; use spaces instead.
Fix it now
Try in validator (prefill this example)