Skip to content
Latchkey

Gradle "Could not load entry ... from remote build cache" in CI

Gradle tried to reuse a task output from the build cache and could not fetch or unpack that entry. By default a cache miss is non-fatal, but with strict settings or a corrupt entry the load failure surfaces and can fail the build.

What this error means

The log shows "Could not load entry <hash> from remote build cache" or "Could not unpack ..." followed by an IO or unpack exception for a cached task output.

Gradle
> Could not load entry 7f3c... from remote build cache:
  Could not unpack tree 'compileJava' into ...: invalid entry in cache artifact

Common causes

A transient failure reaching the cache backend

A network drop or timeout to the remote cache means the entry cannot be fetched on this attempt.

A corrupt or truncated cache entry

A partially written cache artifact cannot be unpacked, so the load fails until the entry is evicted or recreated.

How to fix it

Re-run, optionally bypassing the cache once

  1. Re-run the build so a transient fetch failure can succeed on retry.
  2. If a single entry is corrupt, run once with --no-build-cache to recompute and republish it.
  3. Evict the bad entry from the remote cache if it persists.
Terminal
./gradlew build --no-build-cache

Keep cache load non-fatal

Ensure the build does not treat a cache load miss as fatal so a flaky cache does not break CI; let Gradle recompute the task.

settings.gradle.kts
buildCache {
  remote(HttpBuildCache::class) { isPush = true }
}

How to prevent it

  • Allow cache misses to recompute rather than failing the build.
  • Monitor the remote cache backend for availability.
  • Evict corrupt entries so they stop being fetched.

Related guides

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