GitHub Actions matrix fail-fast cancels healthy sibling jobs unexpectedly
A matrix runs each combination as an independent job, but strategy.fail-fast is true by default. The first job that fails triggers cancellation of every other in-flight matrix job, so green legs show up as "Cancelled".
What this error means
One matrix leg fails and the rest of the matrix immediately flips to Cancelled even though those legs were passing.
build (node-18) failure
build (node-20) cancelled
build (node-22) cancelled
The strategy configuration was canceled because "build (node-18)" failed.Common causes
strategy.fail-fast defaults to true
When unset, a single failing leg cancels all sibling legs in the same strategy block.
A flaky leg poisons the whole matrix
One intermittently failing combination cancels otherwise-passing combinations, hiding their real result.
How to fix it
Disable fail-fast to let every leg finish
- Set strategy.fail-fast: false so legs run to completion independently.
- Keep it true only when you intentionally want fast cancellation on first failure.
jobs:
build:
strategy:
fail-fast: false
matrix:
node: [18, 20, 22]
runs-on: latchkey-smallQuarantine the flaky leg instead
- Add continue-on-error to the specific flaky combination via matrix include.
- This keeps fail-fast for genuine failures while tolerating the known-flaky leg.
How to prevent it
- Decide fail-fast intent explicitly per job rather than relying on the default.
- Use fail-fast: false on broad compatibility matrices where every result is useful.