Skip to content
Latchkey

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

  1. Set HF_HOME to a mount with more free space.
  2. Remove unused tool caches at the start of the job to reclaim disk.
  3. Download only the models the job needs.
.github/workflows/ci.yml
env:
  HF_HOME: /mnt/large/hf-cache

Prune the HF cache

Delete stale revisions so the cache does not grow without bound.

Terminal
pip install "huggingface_hub[cli]"
huggingface-cli delete-cache

How to prevent it

  • Store the HF cache on a volume sized for your models.
  • Prune old revisions with delete-cache regularly.
  • Download only required models and datasets in CI.

Related guides

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