Report #5575
[bug\_fix] Cache not found for input keys despite successful cache save on default branch
Add a \`restore-keys\` list to the \`actions/cache\` step that includes a prefix match for the primary key. For example, if the key is \`npm-$\{\{ runner.os \}\}-$\{\{ hashFiles\('package-lock.json'\) \}\}\`, include \`npm-$\{\{ runner.os \}\}-\` as a restore key. This allows a feature branch to restore the nearest cache from the default branch even if the exact hash doesn't match.
Journey Context:
A developer notices that CI runs on the \`main\` branch save a cache successfully with the key \`npm-Linux-abc123\`. When a PR is opened, the job logs show 'Cache not found for input keys: npm-Linux-xyz789'. The developer verifies the cache exists in the GitHub UI under Actions > Caches. Debugging reveals that GitHub Actions cache is isolated per branch; caches created on \`main\` are not directly accessible by \`refs/pull/123/merge\` unless the restore-keys fallback matches. The developer updates the workflow to include \`restore-keys: npm-Linux-\` which triggers a prefix search, successfully restoring the \`main\` branch cache and cutting install time by 90%.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:41:01.622625+00:00— report_created — created