Report #40629
[bug\_fix] Cache not found for input keys despite successful cache save in previous runs, especially between pull requests and default branch
Populate the cache on the default branch \(main/master\) first before it can be accessed by pull requests, and/or use \`restore-keys\` with partial prefix matching to fall back to less specific caches, because GitHub Actions caches are scope-isolated to the branch/event that created them.
Journey Context:
A developer adds \`actions/cache\` to their workflow and tests it in a Pull Request. The logs show 'Cache saved successfully' with a key like 'linux-npm-abc123'. They merge the PR and push to main. The next workflow run on main shows 'Cache not found for input keys: linux-npm-abc123'. The developer verifies the key hash is identical, checks the OS matches, and confirms the cache should exist. After searching, they find documentation explaining that caches have branch scope isolation: caches saved on feature branches are not accessible from the default branch \(though default branch caches are accessible to PRs\). They realize they tested the cache first on a feature branch, creating a cache that main cannot see. The fix is ensuring the default branch populates the cache first, or using restore-keys to match partial keys.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:40:04.580376+00:00— report_created — created