{"record":{"id":"0c45919a321d8c24","repo":"GoogleContainerTools/jib","slug":"unknown-manifest-type-firstmanifest","errorCode":null,"errorMessage":"Unknown manifest type: <firstManifest>","messagePattern":"Unknown manifest type: <firstManifest>","errorType":"exception","errorClass":"CacheCorruptedException","httpStatus":null,"severity":"error","filePath":"jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageReader.java","lineNumber":73,"sourceCode":"      throw new CacheCorruptedException(metadataCacheDirectory, \"Manifest list missing\");\n    }\n\n    ManifestTemplate firstManifest = manifestsAndConfigs.get(0).getManifest();\n    if (firstManifest instanceof V21ManifestTemplate) {\n      if (metadata.getManifestList() != null\n          || manifestsAndConfigs.stream().anyMatch(entry -> entry.getConfig() != null)) {\n        throw new CacheCorruptedException(metadataCacheDirectory, \"Schema 1 manifests corrupted\");\n      }\n    } else if (firstManifest instanceof BuildableManifestTemplate) {\n      if (manifestsAndConfigs.stream().anyMatch(entry -> entry.getConfig() == null)) {\n        throw new CacheCorruptedException(metadataCacheDirectory, \"Schema 2 manifests corrupted\");\n      }\n      if (metadata.getManifestList() != null\n          && manifestsAndConfigs.stream().anyMatch(entry -> entry.getManifestDigest() == null)) {\n        throw new CacheCorruptedException(metadataCacheDirectory, \"Schema 2 manifests corrupted\");\n      }\n    } else {\n      throw new CacheCorruptedException(\n          metadataCacheDirectory, \"Unknown manifest type: \" + firstManifest);\n    }\n  }\n\n  private final CacheStorageFiles cacheStorageFiles;\n\n  CacheStorageReader(CacheStorageFiles cacheStorageFiles) {\n    this.cacheStorageFiles = cacheStorageFiles;\n  }\n\n  /**\n   * Returns {@code true} if all image layers described in a manifest have a corresponding file\n   * entry in the cache.\n   *\n   * @param manifest the image manifest\n   * @return a boolean\n   */\n  boolean areAllLayersCached(ManifestTemplate manifest) {","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageReader.java#L55-L91","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Delete the cache directory so manifests are re-fetched with the current Jib version","Use matching Jib plugin/core versions across builds sharing the cache","Upgrade Jib if the base image now emits a newer manifest media type","Pin the base image to a tag/digest that produces a supported manifest type"],"exampleFix":"// before (jib-maven-plugin 1.x reading cache from 3.x)\n<plugin>com.google.cloud.tools:jib-maven-plugin:1.8.0</plugin>\n// after\n<plugin>com.google.cloud.tools:jib-maven-plugin:3.4.0</plugin>\nrm -rf ~/.cache/google-cloud-tools-java/jib","handlingStrategy":"fallback","validationCode":"// Ensure plugin and jib-core versions align\nSystem.out.println(BuildSystem.class.getPackage().getImplementationVersion());","typeGuard":null,"tryCatchPattern":"try {\n  build();\n} catch (CacheCorruptedException e) {\n  // unknown manifest type => stale/newer cache format\n  wipeCache();\n  build();\n}","preventionTips":["Keep jib plugin and jib-core versions in sync","Clear cache after any Jib version change","Pin base images to digests known to produce supported manifests"],"tags":["cache","manifest","version-incompatibility"],"backgroundTag":"corrupted-cache-metadata","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}