Azure Pipelines "##[error]No space left on device"
A write failed because the agent volume is full. The hosted image ships a fixed disk, and large build output, container layers, or restored caches can exhaust it before the job finishes.
What this error means
A step fails with No space left on device or ENOSPC: no space left on device, often during a build, a docker build, an artifact upload, or a cache save.
tar: write error: No space left on device
##[error]ENOSPC: no space left on device, write
##[error]Bash exited with code '1'.Common causes
Build output or Docker layers fill the volume
Hosted images allocate a fixed amount of free disk. Large node_modules, build artifacts, or accumulated docker build layers can use it all in one job.
A restored cache or downloaded artifacts are oversized
Restoring a multi-gigabyte cache or downloading every prior artifact leaves little headroom for the actual build.
How to fix it
Free disk before the heavy step
Remove large preinstalled toolsets you do not need, or prune Docker between steps, to reclaim space on the volume.
steps:
- script: |
df -h
sudo rm -rf /usr/share/dotnet /opt/ghc "/usr/local/share/boost"
docker system prune -af
df -h
displayName: 'Free disk space'Shrink what you write to disk
- Avoid caching or downloading artifacts the job does not use.
- Clean intermediate build output between stages.
- For very large builds, move to a self-hosted agent with a larger disk.
How to prevent it
- Print
df -hearly so a full disk is visible before the failing step. - Prune Docker images and build caches you no longer need.
- Use a self-hosted agent with adequate disk for large builds.