GitHub Actions upload-artifact v4: "already exists" — the matrix artifact name collision that became a hard failure
Problem
A matrix workflow that ran fine for a year starts failing on every job after the first:
Error: Failed to CreateArtifact: Received non-retryable error returned from GitHub: Request failed
with status 422: an artifact with this name already exists on the workflow run
(artifact: build-output, matrix job: test (ubuntu-latest, node 20))The trigger was invisible in the diff: the action version went from upload-artifact@v3 to @v4.
Root cause
upload-artifact@v3 allowed matrix jobs to upload artifacts with the same name, silently overwriting each other — the classic bug that only showed up later when a download fetched the wrong variant. v4 made each artifact an immutable feed-stored entry with a unique-name requirement: the second matrix job uploading build-output to the same run gets a hard 422, because the old overwrite behavior was the bug being fixed.
So this error is the new collision detection working as designed — the workflow's artifact names were never unique, and v3 was hiding that. The related downstream break: any download-artifact step that fetched by the old shared name now finds nothing or gets one job's variant, since v4 stores each name separately.
jobs:
build:
strategy:
… 18 more lines in the fix🔒 the fix — including 2 code blocks — is members-only. $1/mo unlocks everything.