{"record":{"id":"b52ec42fcfad7b8d","repo":"GoogleContainerTools/jib","slug":"schema-1-manifests-corrupted","errorCode":null,"errorMessage":"Schema 1 manifests corrupted","messagePattern":"Schema 1 manifests corrupted","errorType":"exception","errorClass":"CacheCorruptedException","httpStatus":null,"severity":"error","filePath":"jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageReader.java","lineNumber":62,"sourceCode":"  @VisibleForTesting\n  static void verifyImageMetadata(ImageMetadataTemplate metadata, Path metadataCacheDirectory)\n      throws CacheCorruptedException {\n    List<ManifestAndConfigTemplate> manifestsAndConfigs = metadata.getManifestsAndConfigs();\n    if (manifestsAndConfigs.isEmpty()) {\n      throw new CacheCorruptedException(metadataCacheDirectory, \"Manifest cache empty\");\n    }\n    if (manifestsAndConfigs.stream().anyMatch(entry -> entry.getManifest() == null)) {\n      throw new CacheCorruptedException(metadataCacheDirectory, \"Manifest(s) missing\");\n    }\n    if (metadata.getManifestList() == null && manifestsAndConfigs.size() != 1) {\n      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) {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageReader.java#L44-L80","documentation":"For schema 1 (Docker v2.1) cached manifests, verifyImageMetadata requires that no manifest list was stored and that no config blobs are present, since schema 1 manifests embed their config differently. If either is present, the cached schema-1 metadata is inconsistent and CacheCorruptedException('Schema 1 manifests corrupted') is thrown.","triggerScenarios":"retrieveMetadata finds firstManifest instanceof V21ManifestTemplate while getManifestList() != null or any entry has getConfig() != null — schema-1 entries mixed with schema-2-style metadata in the cache.","commonSituations":"Base image registry serves schema 1 for very old images (e.g. legacy Docker Hub images) and the cache got mixed writes; cache written by an older Jib version then read by a newer one; concurrent builds writing different manifest schemas to the same cache.","solutions":["Clear the Jib cache directory and rebuild online so a single consistent metadata set is written","Prefer a base image served as schema 2/OCI (most modern registries); legacy schema 1 is deprecated by registries","Ensure only one build process uses the cache directory at a time (or use separate cache dirs per build)","Upgrade Jib to a current version, which handles registry manifest schema negotiation consistently"],"exampleFix":"// before\nfrom openjdk:8   // very old tag, schema 1 registry response, stale cache\n// after\nrm -rf ~/.cache/google-cloud-tools-jib\n<from><image>eclipse-temurin:17-jre</image></from>   // schema 2/OCI base image","handlingStrategy":"fallback","validationCode":"crane manifest $BASE_IMAGE | jq -e '.schemaVersion == 2'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use schema 2/OCI base images"],"tags":["cache","schema-1","manifest","corruption","jib"],"backgroundTag":"cache-corruption","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"}