GoogleContainerTools/jib · error · CacheCorruptedException

Unknown manifest type: <firstManifest>

Error message

Unknown manifest type: <firstManifest>

What it means

If the first cached manifest is neither V21ManifestTemplate (Schema 1), a BuildableManifestTemplate (Schema 2 / OCI), nor a known unsupported type, verifyImageMetadata has no parsing path for it and throws CacheCorruptedException("Unknown manifest type: <firstManifest>"). The message includes the manifest object's toString for diagnosis.

Source

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

      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");
      }
      if (metadata.getManifestList() != null
          && manifestsAndConfigs.stream().anyMatch(entry -> entry.getManifestDigest() == null)) {
        throw new CacheCorruptedException(metadataCacheDirectory, "Schema 2 manifests corrupted");
      }
    } else {
      throw new CacheCorruptedException(
          metadataCacheDirectory, "Unknown manifest type: " + firstManifest);
    }
  }

  private final CacheStorageFiles cacheStorageFiles;

  CacheStorageReader(CacheStorageFiles cacheStorageFiles) {
    this.cacheStorageFiles = cacheStorageFiles;
  }

  /**
   * Returns {@code true} if all image layers described in a manifest have a corresponding file
   * entry in the cache.
   *
   * @param manifest the image manifest
   * @return a boolean
   */
  boolean areAllLayersCached(ManifestTemplate manifest) {

View on GitHub (pinned to fb949e2676)

Solutions

  1. Delete the cache directory so manifests are re-fetched with the current Jib version
  2. Use matching Jib plugin/core versions across builds sharing the cache
  3. Upgrade Jib if the base image now emits a newer manifest media type
  4. Pin the base image to a tag/digest that produces a supported manifest type

Example fix

// before (jib-maven-plugin 1.x reading cache from 3.x)
<plugin>com.google.cloud.tools:jib-maven-plugin:1.8.0</plugin>
// after
<plugin>com.google.cloud.tools:jib-maven-plugin:3.4.0</plugin>
rm -rf ~/.cache/google-cloud-tools-java/jib
Defensive patterns

Strategy: fallback

Validate before calling

// Ensure plugin and jib-core versions align
System.out.println(BuildSystem.class.getPackage().getImplementationVersion());

Try / catch

try {
  build();
} catch (CacheCorruptedException e) {
  // unknown manifest type => stale/newer cache format
  wipeCache();
  build();
}

Prevention

When it happens

Trigger: retrieveMetadata() -> verifyImageMetadata() deserializes the cached manifest JSON into a ManifestTemplate subclass that falls into the final else branch of the type check (neither V21 nor Buildable nor the ignored V22/OCI unsupported list).

Common situations: Cache written by a newer Jib supporting a manifest type an older Jib cannot read, downgrading the Jib plugin version while reusing an old cache, or corrupted/foreign files in the cache metadata directory.

Related errors


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