Skip to content
Latchkey

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 2

Common 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

  1. Add cleanWs() so workspaces are cleared after builds.
  2. Prune Docker images and old caches on the agent.
Jenkinsfile
post { always { cleanWs() } }

Grow the agent disk

  1. 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →