GitLab CI cache "WARNING: ... no such file or directory" in CI
The runner tried to archive or restore a cache and the path is empty or missing, or no cache exists yet. These are warnings: the job continues, but the cache does not help until the path and key are correct.
What this error means
The log shows "WARNING: <path>: no such file or directory" while creating the cache, or "WARNING: file does not exist" / "No URL provided, cache will not be downloaded" when restoring.
Creating cache default...
WARNING: node_modules/: no such file or directory
Failed to create cacheCommon causes
The cached path was not created before archiving
The job caches node_modules/ but the install step did not run or wrote elsewhere, so there is nothing to archive.
A first run with no existing cache
On the first pipeline for a key, there is no cache to download yet, so the restore warning is expected once.
How to fix it
Cache a path the job actually produces
- Run the step that creates the path before the cache is archived.
- Point
cache:pathsat the real output location. - Use a stable
cache:keyso later runs can restore it.
build:
cache:
key:
files:
- package-lock.json
paths:
- node_modules/
script:
- npm ciTreat a first-run restore warning as normal
The "cache will not be downloaded" warning on the very first run for a key is expected; it should disappear once a cache is created.
How to prevent it
- Create cached paths before the cache is archived.
- Use file-based cache keys so caches are reused across runs.
- Distinguish a benign first-run miss from a persistent cache failure.