Skip to content
Latchkey

GitHub Actions hashFiles returned empty (no files matched)

hashFiles returns an empty string when its glob matches no files. That empty value collapses your cache key, so every run shares (and overwrites) the same broad key, or the cache never restores meaningfully.

What this error means

A warning notes no files matched the hashFiles pattern, and the cache key ends with an empty hash segment.

github-actions
Warning: No file matched to [package-lock.json]. The glob pattern is correct?
key: deps-${{ runner.os }}-

Common causes

Glob path is wrong or file not checked out

The lockfile lives in a subdirectory, or checkout has not run, so the glob matches nothing.

File genuinely absent for this project type

The hashed file does not exist in the repo, so the pattern can never match.

How to fix it

Point hashFiles at a real, checked-out file

  1. Ensure checkout runs before the cache step.
  2. Use a glob that matches the actual lockfile path, including subdirectories with **.
  3. Re-run and confirm the key has a non-empty hash.
.github/workflows/ci.yml
- uses: actions/checkout@v4
- uses: actions/cache@v4
  with:
    path: node_modules
    key: deps-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

How to prevent it

  • Verify the hashFiles glob matches a checked-out file before relying on it.
  • Run checkout before any cache step that hashes repo files.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →