Skip to content
Latchkey

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.

Actions log
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

.github/workflows/ci.yml
- 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

  1. Add a scope keyed on the workflow so jobs do not evict each other.
  2. Re-run when the export fails with a transient cache-service status code.
  3. 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.

Related guides

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