GitHub Actions YAML "did not find expected key"
By Kaveh Alemi·Latchkey
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
- Verify every sibling key sits at the exact same column.
- Confirm each step under steps begins with a dash.
- 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.
Frequently asked questions
What causes ""did not find expected key""?
A key that is one space deeper or shallower than its siblings is read as a continuation, so the next key is unexpected.
How do I fix "did not find expected key"?
Align keys and add missing dashes
Related guides
References