GoogleContainerTools/jib · error · LayerPropertyNotFoundException

Blob not available for reference layer without diff ID

Error message

Blob not available for reference layer without diff ID

What it means

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.

Source

Thrown at jib-core/src/main/java/com/google/cloud/tools/jib/image/ReferenceNoDiffIdLayer.java:43

 * layer with its digest and size, but <b>not</b> its diff ID.
 */
public class ReferenceNoDiffIdLayer implements Layer {

  /** The {@link BlobDescriptor} of the compressed layer content. */
  private final BlobDescriptor blobDescriptor;

  /**
   * Instantiate with a {@link BlobDescriptor} and no diff ID.
   *
   * @param blobDescriptor the blob descriptor
   */
  public ReferenceNoDiffIdLayer(BlobDescriptor blobDescriptor) {
    this.blobDescriptor = blobDescriptor;
  }

  @Override
  public Blob getBlob() throws LayerPropertyNotFoundException {
    throw new LayerPropertyNotFoundException(
        "Blob not available for reference layer without diff ID");
  }

  @Override
  public BlobDescriptor getBlobDescriptor() {
    return blobDescriptor;
  }

  @Override
  public DescriptorDigest getDiffId() throws LayerPropertyNotFoundException {
    throw new LayerPropertyNotFoundException(
        "Diff ID not available for reference layer without diff ID");
  }
}

View on GitHub (pinned to fb949e2676)

Solutions

  1. Use getBlobDescriptor() for size/digest instead of getBlob()
  2. Download the layer blob via RegistryClient using the digest if content is needed
  3. Catch LayerPropertyNotFoundException when processing layers of unknown concrete type

Example fix

// before
Blob blob = layer.getBlob();
// after
BlobDescriptor desc = layer.getBlobDescriptor(); // digest and size always available
Defensive patterns

Strategy: type-guard

Validate before calling

boolean hasBlob = !(layer instanceof ReferenceNoDiffIdLayer);

Type guard

boolean blobAvailable(Layer l) { return !(l instanceof ReferenceNoDiffIdLayer) && !(l instanceof DigestOnlyLayer); }

Try / catch

try { Blob b = layer.getBlob(); } catch (LayerPropertyNotFoundException e) { /* use descriptor digest to fetch from registry */ }

Prevention

When it happens

Trigger: Calling Layer.getBlob() on a ReferenceNoDiffIdLayer, which is what JsonToImageTranslator.toImage creates for every layer parsed from a manifest template.

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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