GitHub Actions Buildx type=gha Cache Export Fails
A Docker build using cache-to: type=gha could not export layers to the Actions cache. Most often this is a transient cache-service error; sometimes a missing scope makes entries collide or evict.
What this error means
The build-push step warns or errors while exporting the gha cache, often with a 4xx/5xx from the cache service. The image still builds, but cache export is unreliable across runs.
ERROR: failed to solve: failed to compute cache key: failed to copy:
httpReadSeeker: failed open: unexpected status code ... 400 (transient)Common causes
Transient Actions cache service error
The type=gha backend uploads layers to the same cache service that backs actions/cache. A brief 4xx/5xx during export fails the cache-to step through no fault of the build.
Missing or colliding cache scope
Without a scope, multiple workflows can contend for the same gha cache entries, causing evictions and inconsistent exports.
How to fix it
Scope the gha cache and use mode=max
- uses: docker/build-push-action@v6
with:
cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }}Retry transient export failures
- Add a scope keyed on the workflow so jobs do not evict each other.
- Re-run when the export fails with a transient cache-service status code.
- Use mode=max to cache intermediate layers for better hit rates.
How to prevent it
- Scope type=gha cache per workflow to avoid cross-job eviction.
- Use mode=max for fuller layer caching.
- Treat cache-service 4xx/5xx during export as retryable.