GitHub Actions "A mapping was found where a sequence is expected"
Keys such as steps, on (event list), and a multi-value needs expect a YAML sequence. Writing them as a mapping (key: value pairs) instead of a list of items triggers this structural error.
What this error means
The workflow is invalid at parse time complaining a mapping was found where a sequence was expected, pointing at a list-typed key.
github-actions
Invalid workflow file: .github/workflows/ci.yml#L10
A mapping was found where a sequence is expectedCommon causes
List key written as a mapping
Omitting the leading dashes turns an intended list into a mapping.
Indentation collapsed a list
Misaligned indentation merges list items into a mapping node.
How to fix it
Write the key as a list
- Add leading dashes to each list item under the key.
- Confirm indentation is consistent across items.
- Validate with actionlint or a YAML schema.
.github/workflows/ci.yml
steps:
- uses: actions/checkout@v4
- run: npm testHow to prevent it
- Run actionlint to catch sequence/mapping mismatches.
- Use editor schema validation for GitHub Actions YAML.
Related guides
GitHub Actions "jobs.X.steps must be a sequence"Fix "Invalid workflow file: jobs.X.steps must be a sequence" - steps was written as a mapping instead of a YA…
GitHub Actions "You have an error in your YAML syntax" (tab characters)Fix "You have an error in your YAML syntax on line N" caused by tab characters - YAML forbids tabs for indent…
GitHub Actions "'runs-on' is required"Fix "'runs-on' is required" - every GitHub Actions job must declare a runner with runs-on (unless it only cal…