Skip to content
Latchkey

How to Debug a Cache Key Miss in GitHub Actions

A cache that never restores usually has a key that changes every run or a path that is empty at save time.

The step log prints the resolved key and either "Cache restored from key" or "Cache not found for input keys". Compare the key across two runs. If it differs when it should not, your hashFiles glob matches a file that changes, or the key includes a per-run value.

Steps

  • Read the "Cache not found for input keys" line to see the exact key tried.
  • Print hashFiles(...) to confirm it is stable across runs.
  • Confirm the cached path actually contains files at save time.

Print the resolved key

.github/workflows/ci.yml
- run: echo "key=deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }}"

Common causes

  • The key contains github.sha or a timestamp, so it never repeats.
  • The path is empty because install runs before the cache save is meaningful.
  • hashFiles matched nothing (empty hash), so the key never changes but nothing was ever saved under it.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →