tar: "write error: No space left on device" Restoring Cache
By Kaveh Alemi·Latchkey
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 2
Common 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.
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.
Frequently asked questions
What causes "tar no space (cache)"?
Big dependency or build caches can outgrow what is left on a small runner once the checkout and tooling are present.
How do I fix tar no space (cache)?
Remove unneeded preinstalled SDKs and prune caches early in the job.
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.