Python "IOError: [Errno 28] No space left on device" in CI
By Kaveh Alemi·Latchkey
Python raised [Errno 28] No space left on device - the POSIX ENOSPC errno surfaced as an OSError/IOError. A write to the full runner disk was refused by the kernel.
What this error means
A Python step fails with OSError: [Errno 28] No space left on device while writing a file, a cache, a model checkpoint, or a temp file. The disk is full; df -h confirms 100%. Cleanup or a bigger disk fixes it with no code change.
Python traceback
OSError: [Errno 28] No space left on device
# during e.g. open(path, 'w').write(...), shutil.copy, or torch.save(...)
Common causes
The runner disk is full
Caches (~/.cache/pip), datasets, checkpoints, and build output filled the filesystem. The next write - wherever it lands - fails with errno 28.
A large dataset or model artifact exceeded the disk
Data-heavy Python jobs (ML training, large downloads) can write more than a small runner disk holds within a single step.
How to fix it
Check space and the largest paths
Terminal
df -h
du -xh ~ /tmp 2>/dev/null | sort -rh | head
Reclaim space or relocate large writes
Clear caches (pip cache purge, rm -rf ~/.cache/*) and old artifacts.
Write large outputs (checkpoints, datasets) to a larger scratch volume.
Stream/process data instead of materializing it all on disk.
How to prevent it
Clean caches between jobs on reused runners.
Point large-output paths at a roomy scratch volume.
Use larger-disk runners for data- or model-heavy pipelines.
Frequently asked questions
What causes ""[Errno 28] No space left on device""?
Caches (~/.cache/pip), datasets, checkpoints, and build output filled the filesystem. The next write - wherever it lands - fails with errno 28.
How do I fix "[Errno 28] No space left on device"?
Check space and the largest paths
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.