GitHub Actions matrix produced duplicate combinations
When matrix include adds entries that collide with the base expansion, or a dynamic matrix repeats values, the strategy produces duplicate combinations - either rejected or run redundantly.
What this error means
The matrix runs the same combination twice, or validation flags duplicate combinations.
github-actions
Error: Matrix produced duplicate combinations.
The combination { os: ubuntu-latest, node: 20 } appears more than once.Common causes
include re-adds an existing combination
A matrix.include entry recreates a combination already in the base expansion.
Dynamic matrix with repeated values
A fromJSON array contains duplicate objects.
How to fix it
De-duplicate the matrix
- Use include only to add new combinations or extra keys, not to repeat existing ones.
- Deduplicate the JSON feeding a dynamic matrix before fromJSON.
.github/workflows/ci.yml
strategy:
matrix:
os: [ubuntu-latest]
node: [18, 20]
include:
- os: macos-latest
node: 20How to prevent it
- Understand include semantics: it extends or adds, it does not silently overwrite.
- Validate dynamic matrix JSON for uniqueness in the generating step.
Frequently asked questions
What causes ""matrix produced duplicate combinations""?
A matrix.include entry recreates a combination already in the base expansion.
How do I fix "matrix produced duplicate combinations"?
De-duplicate the matrix
Related guides
GitHub Actions Matrix include/exclude Produces Wrong CombinationsFix GitHub Actions matrix include/exclude surprises - include adding extra jobs, expanding existing combinati…
GitHub Actions matrix include creates an unexpected combinationFix a GitHub Actions matrix where include adds or alters combinations unexpectedly - include both extends and…
GitHub Actions "matrix cannot expand from secrets"Fix a matrix that fails to build because it references the secrets context, which is not available where the…