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 keyCommon 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 buildHow to prevent it
- Enable YAML indentation guides in your editor.
- Run yamllint or actionlint before committing.
Related guides
GitHub Actions "mapping values are not allowed in this context"Fix the GitHub Actions YAML error "mapping values are not allowed in this context" caused by a stray colon or…
GitHub Actions "Invalid workflow file: error in your yaml syntax"Fix the GitHub Actions "Invalid workflow file: You have an error in your yaml syntax" message caused by tabs,…
GitHub Actions "every step must define a uses or run key"Fix the GitHub Actions "every step must define a uses or run key" validation error caused by a step that has…