Report #14878
[bug\_fix] Cache not found for input keys warning followed by full dependency reinstall, despite previous successful cache saves, or cache saves appearing to succeed but restores consistently missing.
Ensure the cache \`path\` matches exactly between the save and restore steps, and use \`restore-keys\` with a prefix fallback \(e.g., \`restore-keys: $\{\{ runner.os \}\}-npm-\`\). The root cause is that cache keys are immutable and must match exactly; if the key changes \(e.g., including a hash that changes frequently\) or if the path differs between save and restore, the lookup fails. Using restore-keys allows partial matching on the prefix, enabling cache hits even when the exact key changes.
Journey Context:
Your workflow takes 15 minutes to install npm dependencies because the cache is never hit. You inspect the cache step and see it saves successfully with key \`Linux-npm-abc123\`, but on the next run, it looks for \`Linux-npm-def456\` \(because the package-lock hash changed\) and reports "Cache not found." You realize the cache key is too specific. You change the key to \`Linux-npm-$\{\{ hashFiles\('package-lock.json'\) \}\}\` but add \`restore-keys: Linux-npm-\` so that even if the lockfile changes, it falls back to the most recent Linux-npm- cache. This allows the cache to hit partially, reducing install time to 2 minutes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:41:23.069082+00:00— report_created — created