{"record":{"id":"c4f5e540861f17ec","repo":"GoogleContainerTools/jib","slug":"blob-not-available-for-reference-layer-without-dif","errorCode":null,"errorMessage":"Blob not available for reference layer without diff ID","messagePattern":"Blob not available for reference layer without diff ID","errorType":"exception","errorClass":"LayerPropertyNotFoundException","httpStatus":null,"severity":"error","filePath":"jib-core/src/main/java/com/google/cloud/tools/jib/image/ReferenceNoDiffIdLayer.java","lineNumber":43,"sourceCode":" * layer with its digest and size, but <b>not</b> its diff ID.\n */\npublic class ReferenceNoDiffIdLayer implements Layer {\n\n  /** The {@link BlobDescriptor} of the compressed layer content. */\n  private final BlobDescriptor blobDescriptor;\n\n  /**\n   * Instantiate with a {@link BlobDescriptor} and no diff ID.\n   *\n   * @param blobDescriptor the blob descriptor\n   */\n  public ReferenceNoDiffIdLayer(BlobDescriptor blobDescriptor) {\n    this.blobDescriptor = blobDescriptor;\n  }\n\n  @Override\n  public Blob getBlob() throws LayerPropertyNotFoundException {\n    throw new LayerPropertyNotFoundException(\n        \"Blob not available for reference layer without diff ID\");\n  }\n\n  @Override\n  public BlobDescriptor getBlobDescriptor() {\n    return blobDescriptor;\n  }\n\n  @Override\n  public DescriptorDigest getDiffId() throws LayerPropertyNotFoundException {\n    throw new LayerPropertyNotFoundException(\n        \"Diff ID not available for reference layer without diff ID\");\n  }\n}\n","sourceCodeStart":25,"sourceCodeEnd":58,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-core/src/main/java/com/google/cloud/tools/jib/image/ReferenceNoDiffIdLayer.java#L25-L58","documentation":"ReferenceNoDiffIdLayer models a layer referenced from a manifest by descriptor (size + digest) only, without a diff ID. Since it never holds blob content, getBlob() throws LayerPropertyNotFoundException.","triggerScenarios":"Calling Layer.getBlob() on a ReferenceNoDiffIdLayer, which is what JsonToImageTranslator.toImage creates for every layer parsed from a manifest template.","commonSituations":"Parsing an image manifest (e.g. V22ManifestTemplate) into an Image and then attempting to read layer content; inspecting layers pulled from a registry without downloading blobs.","solutions":["Use getBlobDescriptor() for size/digest instead of getBlob()","Download the layer blob via RegistryClient using the digest if content is needed","Catch LayerPropertyNotFoundException when processing layers of unknown concrete type"],"exampleFix":"// before\nBlob blob = layer.getBlob();\n// after\nBlobDescriptor desc = layer.getBlobDescriptor(); // digest and size always available","handlingStrategy":"type-guard","validationCode":"boolean hasBlob = !(layer instanceof ReferenceNoDiffIdLayer);","typeGuard":"boolean blobAvailable(Layer l) { return !(l instanceof ReferenceNoDiffIdLayer) && !(l instanceof DigestOnlyLayer); }","tryCatchPattern":"try { Blob b = layer.getBlob(); } catch (LayerPropertyNotFoundException e) { /* use descriptor digest to fetch from registry */ }","preventionTips":["Treat manifest-parsed layers as descriptor-only","Fetch content via RegistryClient when needed","Iterate layers using getBlobDescriptor() by default"],"tags":["jib","docker-image","layer","manifest"],"backgroundTag":"unsupported-operation","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}