Skip to content
Latchkey

DVC "Failed to collect ... missing cache" in CI

DVC read the tracking metadata and expected cache objects that are not present locally. On a fresh CI checkout the cache is empty until you pull, so it reports missing cache files.

What this error means

A dvc command fails with "Failed to collect" and lists files "missing cache" or "not in cache", typically right after checkout before any dvc pull ran.

dvc
ERROR: Failed to collect 'data/train.csv': missing cache files:
name: data/train.csv, md5: 3a1b...

Common causes

No dvc pull on the fresh checkout

CI cloned the repo with only the tiny .dvc pointers; the real data lives on the remote and was never pulled into the cache.

A partial or interrupted pull

An earlier dvc pull failed midway, leaving some objects absent from the cache while metadata still references them.

How to fix it

Pull data before using it

  1. Add a dvc pull step after checkout and before any stage or test that reads the data.
  2. Confirm the remote and credentials are set so the pull can complete.
  3. Re-run the job.
.github/workflows/ci.yml
- run: dvc pull

Force a clean re-fetch

If a prior pull was partial, fetch the missing objects explicitly.

Terminal
dvc fetch
dvc checkout

How to prevent it

  • Always dvc pull after checkout before reading tracked data.
  • Cache the .dvc/cache between runs so pulls are incremental.
  • Fail the job early if the pull step reports missing objects.

Related guides

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