GitHub Actions "No space left on device" on the Runner
A step failed because the runner ran out of disk. GitHub-hosted runners ship a fixed disk, and preinstalled toolchains plus Docker images and build artifacts can exhaust it during a heavy job.
What this error means
A build, Docker pull, or file-writing step fails with "no space left on device". The error comes from the kernel, so it can surface from many different commands.
failed to register layer: write /usr/lib/.../libLLVM.so: no space left on device
# or
ENOSPC: no space left on device, writeCommon causes
Large images and build output
Pulling big base images, generating large artifacts, or downloading datasets can fill the runner disk mid-job.
Preinstalled tooling consuming space
Hosted runners come with many preinstalled SDKs and toolchains that occupy several gigabytes you may not need.
How to fix it
Free space at the start of the job
Remove preinstalled tooling you do not use, and prune Docker before the heavy step.
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android
docker image prune --all --force
df -hReduce what the job writes
- Use multi-stage Docker builds and a .dockerignore to shrink context.
- Clean package caches in the same step that creates them.
- Stream large downloads instead of materializing them all on disk.
How to prevent it
- Add a free-disk-space step to image-heavy jobs.
- Use a larger runner or a self-hosted host with more disk for big builds.
- Monitor df -h in CI to catch creeping disk usage.