# GitHub Actions: Cache not found for input keys: npm-Linux-abc123 / Failed to save: Unable to reserve cache with key, another job may be creating this cache

**Code:** `Cache not found / Unable to reserve cache` · **Category:** CI/CD · **Seen on:** GitHub Actions

`actions/cache` either found nothing for your key (restore miss) or could not save because another run is already saving the same key — usually harmless, but a sign your key design needs a look.

## Meaning

A cache is keyed by exact `key`, with `restore-keys` prefixes as fallback. Misses are normal on first run or after the lockfile changes. "Unable to reserve cache" occurs when parallel jobs write the same key; only the first succeeds. Caches are also scoped per branch (a PR can read the default branch's caches, not the reverse) and evicted after 7 days or when the 10 GB limit is reached.

## Common causes

- First run or the key changed (lockfile hash differs)
- Parallel jobs saving the same key
- Cache scoped to another branch or evicted (7 days, 10 GB limit)
- Wrong `path` so nothing was saved
- Using different OS/architecture in the key than in the restore

## Quick fix

1. Use `hashFiles('**/package-lock.json')` in the key plus `restore-keys`
2. Save the cache from one job only (or include `${{ matrix.* }}` in the key)
3. Prefer the built-in cache of `setup-node`/`setup-python`

## Detailed fix by platform

### GitHub Actions

1. `uses: actions/setup-node@v4` with `cache: npm` handles keys for you

## Code examples

### Key with fallback

```yaml
- uses: actions/cache@v4
  with:
    path: ~/.npm
    key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
    restore-keys: |
      npm-${{ runner.os }}-
```

## How to diagnose

1. **Key** — What exact key is requested?
2. **Scope** — Branch of the cache?
3. **Writers** — Several jobs saving the same key?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cicd/gha-cache-not-found-or-reserve-failed)
