Skip to content
Latchkey

GitHub Actions "Invalid workflow file: error in your yaml syntax"

GitHub could not parse your workflow as YAML, so the run never starts. The annotation names the line of the first parse failure.

What this error means

The Actions tab shows "Invalid workflow file" with "You have an error in your yaml syntax on line N". No jobs execute because the file never compiled.

github-actions
Invalid workflow file: .github/workflows/ci.yml#L7
You have an error in your yaml syntax on line 7

Common causes

A tab character used for indentation

YAML forbids tabs for indentation. A pasted tab anywhere in the indent makes the parser reject the file.

Inconsistent indentation depth

Mixing two-space and four-space indentation, or mis-aligning a nested key, breaks the YAML block structure.

How to fix it

Replace tabs with spaces and re-check indentation

  1. Use spaces only, two per nesting level.
  2. Show invisible characters in your editor to spot stray tabs.
  3. Lint with a YAML tool before pushing.
Terminal
yamllint .github/workflows/ci.yml

How to prevent it

  • Add an .editorconfig that enforces spaces for *.yml files.
  • Run actionlint as a pre-commit hook.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →