GoogleContainerTools/jib · error · CacheCorruptedException

Manifest cache empty

Error message

Manifest cache empty

What it means

When reading cached base-image metadata, verifyImageMetadata validates the stored ImageMetadataTemplate. If the list of manifests-and-configs is completely empty, the cache entry is incomplete, so CacheCorruptedException('Manifest cache empty') is thrown to force a fresh fetch rather than building from empty metadata.

Source

Thrown at jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageReader.java:49

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.DigestException;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/** Reads from the default cache storage engine. */
class CacheStorageReader {

  @VisibleForTesting
  static void verifyImageMetadata(ImageMetadataTemplate metadata, Path metadataCacheDirectory)
      throws CacheCorruptedException {
    List<ManifestAndConfigTemplate> manifestsAndConfigs = metadata.getManifestsAndConfigs();
    if (manifestsAndConfigs.isEmpty()) {
      throw new CacheCorruptedException(metadataCacheDirectory, "Manifest cache empty");
    }
    if (manifestsAndConfigs.stream().anyMatch(entry -> entry.getManifest() == null)) {
      throw new CacheCorruptedException(metadataCacheDirectory, "Manifest(s) missing");
    }
    if (metadata.getManifestList() == null && manifestsAndConfigs.size() != 1) {
      throw new CacheCorruptedException(metadataCacheDirectory, "Manifest list missing");
    }

    ManifestTemplate firstManifest = manifestsAndConfigs.get(0).getManifest();
    if (firstManifest instanceof V21ManifestTemplate) {
      if (metadata.getManifestList() != null
          || manifestsAndConfigs.stream().anyMatch(entry -> entry.getConfig() != null)) {
        throw new CacheCorruptedException(metadataCacheDirectory, "Schema 1 manifests corrupted");
      }
    } else if (firstManifest instanceof BuildableManifestTemplate) {
      if (manifestsAndConfigs.stream().anyMatch(entry -> entry.getConfig() == null)) {
        throw new CacheCorruptedException(metadataCacheDirectory, "Schema 2 manifests corrupted");
      }

View on GitHub (pinned to fb949e2676)

Solutions

  1. Delete the Jib cache directory (or the specific image metadata directory) and rebuild online so metadata is re-fetched
  2. Run the build once without offline mode to refresh the metadata cache
  3. Check the metadata JSON files under the cache for truncation if the issue persists
  4. Pin a stable Jib version so cache format expectations match what was written

Example fix

// before
mvn jib:build -Djib.offline=true   // empty metadata cache
// after
rm -rf ~/.cache/google-cloud-tools-jib
mvn jib:build    // online rebuild repopulates cache, then offline works
Defensive patterns

Strategy: retry

Validate before calling

jq -e '.manifestsAndConfigs | length > 0' "$METADATA_FILE" || rm -f "$METADATA_FILE"

Prevention

When it happens

Trigger: retrieveMetadata loads the metadata cache file for the base image and the deserialized manifestsAndConfigs list has size 0 — i.e., the cache file exists but contains no manifest entries (truncated/blank/invalid write).

Common situations: Interrupted previous build that wrote a partial metadata cache; manually deleted/edited cache files; cache migration between Jib versions producing empty entries; corrupted cache on a shared/ephemeral CI volume.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06). Data as JSON: /api/errors/e6c6650a3cf34e37. Report an issue: GitHub.