{"record":{"id":"695ded5ae5d0baa8","repo":"GoogleContainerTools/jib","slug":"schema-2-manifests-corrupted","errorCode":null,"errorMessage":"Schema 2 manifests corrupted","messagePattern":"Schema 2 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":66,"sourceCode":"    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) {\n    this.cacheStorageFiles = cacheStorageFiles;\n  }\n\n  /**","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageReader.java#L48-L84","documentation":"CacheStorageReader.verifyImageMetadata validates cached image metadata against its manifest format. For a Schema 2 manifest, every manifest entry in the cache must reference a config blob; if any entry has no config, the cache metadata is declared corrupted and CacheCorruptedException is thrown. This guards against partially written or hand-edited cache directories producing unusable image metadata.","triggerScenarios":"retrieveMetadata() -> verifyImageMetadata() finds a cached BuildableManifestTemplate (V22ManifestTemplate / OCI manifest) whose manifestsAndConfigs list contains an entry with getConfig() == null.","commonSituations":"Interrupted cache writes (JVM killed mid-write), manual deletion of config blob files under the cache directory, cache directories shared between Jib versions or corrupted by disk issues.","solutions":["Delete the Jib cache directory (default ~/.cache/google-cloud-tools-java/jib or jib.cacheDirectory setting) so it is rebuilt on the next build","Run the build with a fresh cache by setting the <cache> / jib.cacheDirectory parameter to a new location","Upgrade Jib in case an older version wrote cache entries in an incompatible layout","Check for processes (antivirus, sync tools) that delete files from the cache directory"],"exampleFix":"// before (corrupted cache dir reused)\nmvn package jib:build\n// after (clear cache)\nrm -rf ~/.cache/google-cloud-tools-java/jib\nmvn package jib:build","handlingStrategy":"try-catch","validationCode":"// Verify manifest and configs exist before build\nFiles.list(cacheDir.resolve(\"manifests\")).forEach(System.out::println);","typeGuard":"boolean isSchema2MetadataComplete(ImageMetadata m) {\n  return m.getManifestList() == null ||\n    m.getManifestsAndConfigs().stream().allMatch(e -> e.getConfig() != null);\n}","tryCatchPattern":"try {\n  jibBuild();\n} catch (CacheCorruptedException e) {\n  deleteRecursively(cacheDirectory);\n  jibBuild(); // rebuild with fresh cache\n}","preventionTips":["Do not share one cache directory across concurrent builds","Exclude the cache dir from antivirus/cleanup tools","Recreate cache after upgrading Jib versions"],"tags":["cache","corruption","docker-manifest"],"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"}