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.
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
- Add a
dvc pullstep after checkout and before any stage or test that reads the data. - Confirm the remote and credentials are set so the pull can complete.
- Re-run the job.
- run: dvc pullForce a clean re-fetch
If a prior pull was partial, fetch the missing objects explicitly.
dvc fetch
dvc checkoutHow to prevent it
- Always
dvc pullafter checkout before reading tracked data. - Cache the
.dvc/cachebetween runs so pulls are incremental. - Fail the job early if the pull step reports missing objects.