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.
> Could not load entry 7f3c... from remote build cache:
Could not unpack tree 'compileJava' into ...: invalid entry in cache artifactCommon 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
- Re-run the build so a transient fetch failure can succeed on retry.
- If a single entry is corrupt, run once with
--no-build-cacheto recompute and republish it. - Evict the bad entry from the remote cache if it persists.
./gradlew build --no-build-cacheKeep 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.
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.