Report #15503
[bug\_fix] Cache not found for input keys even though cache was saved in a previous run on the default branch
Understand that GitHub Actions caches are immutable and scoped. Caches saved on feature branches are isolated to that branch and its children; only caches saved on the default branch \(or specified base branch\) are available to child branches and PRs. To fix, ensure the cache is created \(saved\) on the default branch first, or use \`restore-keys\` for prefix matching fallback. Root cause: GitHub's cache implementation uses a strict isolation model for security and storage efficiency, unlike some other CI systems that have global cache namespaces.
Journey Context:
A developer sets up a workflow to cache \`node\_modules\` using \`actions/cache@v3\` with \`key: $\{\{ runner.os \}\}-node-$\{\{ hashFiles\('package-lock.json'\) \}\}\`. They push to a PR branch, the cache saves successfully, and the post-action log confirms "Cache saved with key: Linux-node-abc123". They push a second commit to the same PR, expecting a cache hit, but get "Cache not found for input keys: Linux-node-abc123". They check the cache list in the GitHub UI and see the cache exists. After reading the documentation on "Restrictions for accessing a cache", they realize that because the first run was on a PR branch \(not the default branch\), the cache is isolated. They merge the PR, let the cache save on main, and subsequent PRs can then access it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:19:16.380525+00:00— report_created — created