Skip to content
Latchkey

GitHub Actions YAML "did not find expected key"

YAML expected another key at the current indentation but found something else. Almost always a misaligned line or a missing dash.

What this error means

The workflow is rejected with "did not find expected key" at a line where the indentation does not line up with its siblings.

github-actions
Invalid workflow file: .github/workflows/ci.yml#L16
did not find expected key

Common causes

A line indented one space off

A key that is one space deeper or shallower than its siblings is read as a continuation, so the next key is unexpected.

A missing list dash

Forgetting the leading - on a step makes its keys merge into the previous step and the parser loses track.

How to fix it

Align keys and add missing dashes

  1. Verify every sibling key sits at the exact same column.
  2. Confirm each step under steps begins with a dash.
  3. Re-indent with spaces only.
.github/workflows/ci.yml
steps:
  - uses: actions/checkout@v4
  - name: Build
    run: make build

How to prevent it

  • Enable YAML indentation guides in your editor.
  • Run yamllint or actionlint before committing.

Related guides

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