Jenkins "No space left on device" Workspace Error
The agent ran out of disk while writing to the workspace or temp directory, so the build failed with No space left on device.
What this error means
A step fails with "No space left on device" while writing files, cloning, or extracting artifacts. Subsequent builds on the same agent fail the same way until space is freed.
jenkins
tar: write error: No space left on device
ERROR: script returned exit code 2Common causes
Accumulated old workspaces and artifacts
Stale workspaces, caches, and Docker layers fill the disk over many builds.
Large build outputs
A single build generates more data than the agent disk can hold.
Undersized agent volume
The agent or container has too little disk for its workload.
How to fix it
Free space and clean workspaces
- Add cleanWs() so workspaces are cleared after builds.
- Prune Docker images and old caches on the agent.
Jenkinsfile
post { always { cleanWs() } }Grow the agent disk
- Increase the agent volume size or mount a larger workspace disk.
How to prevent it
- If you run on GitHub Actions, self-healing managed runners such as Latchkey auto-retry transient failures and provision fresh runners, avoiding accumulated disk pressure. On Jenkins, clean workspaces and monitor agent disk usage.
Related guides
Jenkins "remote file operation failed" Agent ErrorFix the Jenkins "remote file operation failed" error where a workspace file action on the agent failed, often…
Jenkins "OutOfMemoryError" Build Killed on AgentFix the Jenkins java.lang.OutOfMemoryError where a build process on the agent exhausted heap or the host OOM-…
Jenkins Cloud Agent Provisioning FailedFix the Jenkins cloud agent provisioning failure where the controller could not launch a dynamic Kubernetes,…