tar: "write error: No space left on device" Restoring Cache
A cache archive failed to extract or save because the runner disk filled. The cached payload (dependencies, build outputs) is larger than the remaining free space.
What this error means
The cache step prints tar: write error: No space left on device while unpacking or packing. Clearing other disk usage or using a larger disk resolves it with no workflow change.
shell
Received 0 of 0 (0.0 MB), 0.0 MBs/sec
tar: write error: No space left on device
##[warning] Failed to restore: tar exited with error code 2Common causes
The cache is larger than the free disk
Big dependency or build caches can outgrow what is left on a small runner once the checkout and tooling are present.
Disk already consumed by prior steps
Earlier build artifacts and downloads leave too little room to extract the cache archive.
How to fix it
Free space before the cache step
Remove unneeded preinstalled SDKs and prune caches early in the job.
shell
df -h
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android
docker system prune --all --force
df -hShrink or split the cache
- Scope the cache key to only what is needed (avoid caching huge build trees).
- Exclude generated artifacts from the cached paths.
- Move the job to a runner with a larger disk.
How to prevent it
- Keep cache payloads tight and scoped.
- Free preinstalled bloat before restoring large caches.
- Right-size disk for cache-heavy pipelines.
Related guides
CI "No space left on device" (ENOSPC) on the RunnerFix "No space left on device" (ENOSPC) in CI when the runner disk fills with caches, layers, and artifacts. H…
Docker Layer Cache Filled the Runner DiskFix a runner disk filled by the Docker layer/build cache in CI when /var/lib/docker grew across jobs. How to…
Runner Out of Disk During npm install (ENOSPC)Fix ENOSPC during npm install in CI when node_modules and the npm cache exhaust the runner disk. How to recla…
CI /tmp Directory Full (ENOSPC on tmpfs)Fix ENOSPC from a full /tmp in CI. Temp files or a small tmpfs filled the temp directory. How to clear it, re…