Report #61772
[bug\_fix] Cache restore reports 'Cache not found for input keys' or cache never hits despite unchanged dependencies
Ensure the cache key generation matches exactly between save and restore steps, using stable file hashes \(e.g., hashFiles\('\*\*/package-lock.json'\) without including timestamps or run IDs\). Root cause: Cache keys are immutable; if the key includes run-specific data or the glob pattern doesn't match the lockfile path, the key changes every run or differs between save/restore operations.
Journey Context:
You notice your Node.js workflow installs dependencies from scratch every time despite using actions/cache. You examine the cache step logs and see 'Cache not found for input keys: npm-cache-abc123...'. You check the Post Cache step and see it saved cache with key 'npm-cache-xyz789...'. You realize your key includes $\{\{ github.run\_id \}\} to make it unique, thinking that allows multiple caches. However, this means restore looks for the old run\_id which doesn't exist. You remove the run\_id and use only hashFiles\('\*\*/package-lock.json'\), and now the cache hits correctly. The root cause is that cache keys must be deterministic based on file content; adding unique IDs creates new caches that can never be restored by subsequent runs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:10:13.876210+00:00— report_created — created