Skip to content
Latchkey

GitHub Actions "Invalid workflow file" - Fix YAML Syntax Errors

GitHub could not parse your workflow file as valid YAML, so the run never starts. The annotation names the file, line, and column of the first parse error.

What this error means

The run is rejected before any job executes, with an "Invalid workflow file" annotation in the Actions tab pointing at a specific line and column. No steps run because the file never compiled.

Actions annotation
Invalid workflow file: .github/workflows/ci.yml#L14
You have an error in your yaml syntax on line 14

Common causes

Bad indentation or a stray tab

YAML is whitespace-sensitive and forbids tabs for indentation. A misaligned key or a tab character pasted from an editor makes the parser reject the file.

Missing or misplaced required key

A workflow needs top-level on and jobs, and each job needs runs-on plus steps or uses. Omitting one, or nesting it at the wrong level, fails parsing or validation.

Unquoted value that YAML misreads

Values like on, off, yes, no, or strings that start with a special character get coerced or rejected unless quoted.

How to fix it

Validate the YAML locally before pushing

Lint the workflow with a YAML linter or actionlint, which understands the Actions schema, not just generic YAML.

Terminal
# generic YAML check
yamllint .github/workflows/ci.yml
# Actions-aware linter (catches schema + expression errors)
actionlint

Fix indentation and quote ambiguous values

  1. Use spaces only, two per level, never tabs.
  2. Quote values that YAML coerces, for example branch names like on: or strings beginning with a special character.
  3. Confirm on, jobs, runs-on, and steps sit at the right nesting level.

How to prevent it

  • Run actionlint in CI (or a pre-commit hook) so syntax errors fail fast.
  • Add an .editorconfig that forces spaces, not tabs, in YAML files.
  • Edit workflows with an editor extension that validates the Actions schema.

Frequently asked questions

What causes ""Invalid workflow file""?
YAML is whitespace-sensitive and forbids tabs for indentation. A misaligned key or a tab character pasted from an editor makes the parser reject the file.
How do I fix "Invalid workflow file"?
Lint the workflow with a YAML linter or actionlint, which understands the Actions schema, not just generic YAML.

Related guides

References

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