Report #49347
[bug\_fix] Cache not found for input keys: ... \(cache miss on feature branches despite existing cache on main\)
Ensure the cache is first saved \(seeded\) on the default branch \(main/master\). Feature branches can only restore caches created on their own branch or inherited from the default branch. If the cache key uses dynamic values \(like hash of lockfile\), ensure the lockfile hasn't changed between main and feature branch, or use a restore-keys prefix fallback.
Journey Context:
Developer implements \`actions/cache\` for \`node\_modules\` using a key like \`$\{\{ runner.os \}\}-node-$\{\{ hashFiles\('\*\*/package-lock.json'\) \}\}\`. They push to a feature branch, see "Cache not found for input keys...", then watch the workflow save the cache successfully at the end. On the next push to the same branch, restore works. However, when opening a PR, the cache is missed again despite \`main\` having a green build. The developer assumes caches are global. They check the cache list in the Actions tab and sees the cache exists but is marked with the \`main\` branch tag. After reading the \`actions/cache\` README, they discover the scoping rule: caches are isolated per branch, and only the default branch's caches are accessible to child branches. They realize they need to ensure the cache is populated on \`main\` first, and that feature branch caches are ephemeral. They adjust their workflow to use \`restore-keys\` with a prefix fallback to hit the main branch cache even if the lockfile hash differs slightly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T13:18:29.002577+00:00— report_created — created