Report #46218
[bug\_fix] Failed to save: Unable to reserve cache with key X, another job may be creating this cache
Append matrix-specific identifiers to the cache key \(e.g., \`$\{\{ matrix.os \}\}-$\{\{ matrix.node \}\}\`\) or use a single 'cache-seed' job that runs once to populate the cache while matrix jobs use \`restore-keys\` only. Root cause: Cache keys must be unique; when matrix jobs generate identical keys, they race to reserve the key, causing all but one to fail on save.
Journey Context:
A developer has a Go project testing against 3 OS versions \(ubuntu, macos, windows\) and 2 Go versions \(1.19, 1.20\) — a 6-job matrix. Each job caches Go modules using \`actions/cache\` with key: \`$\{\{ runner.os \}\}-go-$\{\{ hashFiles\('\*\*/go.sum'\) \}\}\`. They notice that sometimes the post-job 'Saving cache' step fails with 'Unable to reserve cache with key Linux-go-abc123, another job may be creating this cache'. They investigate and find that since go.sum is identical across all matrix jobs, all 6 jobs generate the identical cache key. When they run simultaneously, one reserves the key, and the others fail to save. They realize they need to make keys unique per matrix job by including the matrix value in the key: \`$\{\{ runner.os \}\}-$\{\{ matrix.go-version \}\}-$\{\{ hashFiles\('\*\*/go.sum'\) \}\}\`. Alternatively, they refactor to have a single 'cache-seed' job that runs once, saves the cache, and then the matrix jobs only restore it using \`restore-keys\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T08:03:06.946868+00:00— report_created — created