Skip to content
Latchkey

buildx "cache-from type=gha" not found / cache miss warning in CI

A --cache-from type=gha import that finds nothing is a cache miss, not a hard failure: the build still runs, just without reuse. A persistent miss usually means a mismatched scope, the cache expired, or this is the first run that populates it.

What this error means

Builds never hit the cache; logs show "importing cache manifest from gha" with no layers reused, or "failed to configure registry cache importer" warnings, and every step rebuilds.

buildx
#5 importing cache manifest from gha:...
#5 ERROR: failed to configure registry cache importer: ... not found

Common causes

cache-to and cache-from use different scopes

If the export and import scopes do not match, the importer looks under a key nothing was written to and finds no cache.

The cache expired or never existed

GitHub evicts unused cache after a retention window, and the very first build has nothing to import.

How to fix it

Match scope on cache-to and cache-from

  1. Use the same scope value on both cache-to and cache-from.
  2. Ensure at least one prior build wrote the cache with cache-to.
  3. Treat the first run as a cold build that populates the cache.
.github/workflows/ci.yml
cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }}

Order layers for better reuse

Copy dependency manifests and install before copying source so the heavy install layer caches across runs.

Dockerfile
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .

How to prevent it

  • Keep cache-to and cache-from scopes identical.
  • Order Dockerfile layers from least to most frequently changing.
  • Expect cold builds on the first run and after cache eviction.

Related guides

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