Report #39801
[bug\_fix] GitHub Actions cache action always reports 'Cache not found for input keys' despite previous successful runs
Remove dynamic values \(like timestamps, commit SHAs, or run IDs\) from the primary cache key. Use a static key derived from lockfile checksums \(like hashFiles\('\*\*/package-lock.json'\)\) and utilize restore-keys with partial prefix matches for fallback. The root cause is that cache keys must match exactly; if the key changes every run, the cache lookup fails because it's looking for a key that doesn't exist yet.
Journey Context:
The developer notices their Node.js build takes 5 minutes every run despite setting up actions/cache for node\_modules. They check the logs and see 'Cache not found for input keys: node-deps-1699123456'. They look at the key definition and see \`key: node-deps-$\{\{ github.run\_id \}\}\`. They realize that github.run\_id is unique per workflow run, so the cache is being saved with a unique key each time, and the next run looks for a different unique key that doesn't exist yet. They change the key to use \`$\{\{ hashFiles\('\*\*/package-lock.json'\) \}\}\` which only changes when dependencies change, and add \`restore-keys: node-deps-\` as a fallback. The next run finds the cache in 2 seconds because the key matches the previously saved cache.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T21:16:43.884499+00:00— report_created — created