Report #77087
[bug\_fix] Cache not found for input keys despite existing cache or cache misses on feature branches
Configure \`restore-keys\` with a prefix fallback \(e.g., \`$\{\{ runner.os \}\}-npm-\`\) in the \`actions/cache\` step. Root cause: \`actions/cache\` requires an exact key match by default; caches saved on the default branch are scope-restricted and not retrievable by exact key on feature branches. A prefix fallback allows the cache action to match the most recent cache with that prefix from any scope.
Journey Context:
A developer configures \`actions/cache@v4\` for Node.js, setting the key to \`$\{\{ runner.os \}\}-node-$\{\{ hashFiles\('\*\*/package-lock.json'\) \}\}\`. On the first run on \`main\`, the cache saves successfully. They push a feature branch; \`package-lock.json\` is unchanged, so the key is identical, yet the cache step reports "Cache not found for input keys: Linux-node-abc123". Confused, they verify the cache exists in the UI. Searching, they find a StackOverflow explanation: caches are scoped to the base branch for security, so a feature branch cannot see an exact key saved on \`main\`. The solution is to add \`restore-keys: $\{\{ runner.os \}\}-node-\` as a fallback. They update the YAML; the feature branch run now restores the cache using the prefix match, avoiding the expensive reinstall.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:59:13.061735+00:00— report_created — created