GitHub Actions · infra · fg-0223

actions/cache never updates: 'Cache hit occurred on the primary key, not saving cache'

Cache hit occurred on the primary key node-cache, not saving cache.

Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100

Cause

A cache entry is immutable once saved, so a key that never changes is restored forever and never written again. New content needs a new key.

Fix

Put a content hash in the key and use restore-keys for partial matches.

Apply

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

Affects: actions/cache v3 and v4 on github.com, as of October 2026

Sources

Have your agent know this before it fails

claude mcp add --transport http footgun https://getfootgun.com/api/mcp