GitHub Actions "Cache not found for input keys"
actions/cache could not find an entry matching the primary key or any restore-keys prefix, so it reports a miss and the dependent step rebuilds from scratch.
What this error means
The cache step logs "Cache not found for input keys: <key>" and cache-hit is false, so installs or builds run without the cached data.
Cache not found for input keys: Linux-node-3f2a1b, Linux-node-Common causes
First run or key never saved
No prior run saved an entry under that key, so there is nothing to restore (a normal cold cache).
Key changed since the last save
A hash input (lockfile, runner.os) changed the primary key and no restore-keys prefix covers the older entries.
How to fix it
Add fallback restore-keys
- Keep a precise primary key tied to the lockfile hash.
- Add broader restore-keys prefixes for partial hits.
- Confirm the save step runs on the branch that should seed the cache.
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-How to prevent it
- Always pair a precise key with broader restore-keys.
- Seed the cache on the default branch.
- Keep key inputs stable run-to-run.