Hugging Face "No space left on device" filling the HF cache in CI
A model or dataset download exhausted the runner disk, so the write to the HF cache fails with No space left on device. Model weights are large; a small root volume fills fast when several are pulled.
What this error means
A download aborts with "OSError: [Errno 28] No space left on device" while writing into the huggingface cache directory.
huggingface_hub
OSError: [Errno 28] No space left on device:
'/root/.cache/huggingface/hub/models--org--big-model/blobs/...tmp'Common causes
Large weights exceed the runner disk
Multi-gigabyte checkpoints, several at once, fill the default root volume of a standard runner.
An accumulating cache never pruned
A cache restored and grown across runs keeps stale model blobs that eat disk.
How to fix it
Point HF_HOME at a larger volume and free space
- Set
HF_HOMEto a mount with more free space. - Remove unused tool caches at the start of the job to reclaim disk.
- Download only the models the job needs.
.github/workflows/ci.yml
env:
HF_HOME: /mnt/large/hf-cachePrune the HF cache
Delete stale revisions so the cache does not grow without bound.
Terminal
pip install "huggingface_hub[cli]"
huggingface-cli delete-cacheHow to prevent it
- Store the HF cache on a volume sized for your models.
- Prune old revisions with
delete-cacheregularly. - Download only required models and datasets in CI.
Related guides
Hugging Face "429 Too Many Requests" rate limit in CIFix huggingface_hub "429 Client Error: Too Many Requests" in CI - the Hub rate-limited anonymous or bursty re…
Hugging Face "CUDA out of memory" loading a model in CIFix "torch.cuda.OutOfMemoryError: CUDA out of memory" when loading a Hugging Face model in CI - the checkpoin…
Hugging Face Git LFS "smudge filter failed" cloning a model repo in CIFix Git LFS "smudge filter lfs failed" when cloning a Hugging Face model repo in CI - large files are LFS-tra…