GitHub Actions cache key changes every run (never hits)
If the cache key contains something that varies on every run, the primary key is unique each time, so the restore always misses and the save just creates one more never-reused entry.
What this error means
The cache step reports a miss on every single run, cache-hit is always false, and cache storage fills with one new entry per run.
github-actions
Cache not found for input keys: Linux-build-1719300000
(new unique key every run -> permanent miss)Common causes
Volatile token in the key
The key includes github.run_id, github.sha, a timestamp, or similar value that is unique per run.
Hash over files that always change
hashFiles over generated or always-modified files yields a new hash each run.
How to fix it
Key only on stable inputs
- Remove run_id, sha, and timestamps from the primary key.
- Hash only stable inputs like the lockfile.
- Add restore-keys prefixes for partial reuse.
.github/workflows/ci.yml
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-How to prevent it
- Keep cache keys free of per-run values.
- Hash only inputs that change with dependencies.
- Verify cache-hit is true on a repeat run.
Related guides
GitHub Actions "Cache not found for input keys"Understand GitHub Actions "Cache not found for input keys" from actions/cache - no entry matched the primary…
GitHub Actions cache key collision / immutable cache not updatingFix a GitHub Actions cache that never reflects new content because the key is reused and cache entries are im…
GitHub Actions cache restore-keys not matching prefixFix GitHub Actions cache restore-keys that never produce a partial hit because the prefixes do not actually m…