Skip to content
Latchkey

GitHub Actions Cache "Path Validation Error" / No Files Matched the Glob

actions/cache warns that no files matched the configured path, so the save is a no-op. The directory does not exist yet, the glob is wrong, or the path is relative to an unexpected base - every later restore then misses.

What this error means

The cache step logs that there are no matching files for the path, saves nothing, and subsequent runs always report a cache miss for that key even though the key is stable.

Actions log
Warning: There is no matching files for the path '~/.cache/build'.
# nothing is cached, so restores always miss

Common causes

Path does not exist at save time

If the directory is generated later (or never), the cache save finds nothing to store. The cache post-step runs at job end, but the path still must exist by then.

Wrong glob or base directory

A relative path is resolved from the workspace; a typo, a missing ~ expansion, or a non-recursive glob can match nothing on this runner.

How to fix it

Point path at a real, populated directory

Cache a path that exists by the end of the job, and verify it before relying on the cache.

.github/workflows/ci.yml
- uses: actions/cache@v4
  with:
    path: |
      ~/.npm
      node_modules
    key: deps-${{ hashFiles('package-lock.json') }}
- run: ls -la node_modules | head   # confirm it was populated

Fix the glob and base path

  1. Use an absolute path or ~ for home-relative caches so it does not depend on the working directory.
  2. Ensure the step that creates the directory runs before the cache save (i.e. before job end).
  3. Echo the resolved path and list it to confirm files exist before caching.

How to prevent it

  • Cache only paths that exist by job end.
  • Use absolute or ~-anchored paths to avoid base-directory surprises.
  • Verify the cached directory is populated before trusting the cache.

Frequently asked questions

Why does my cache always miss even with a stable key?
If the save found no matching files, nothing was stored under that key, so every restore misses. Fix the path/glob so the save actually caches files.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card