GoogleContainerTools/jib · error · LayerPropertyNotFoundException

Blob not available for reference layer

Error message

Blob not available for reference layer

What it means

ReferenceLayer is a metadata-only view of a layer (blob descriptor + diff ID) referenced from a manifest; it does not hold the layer's compressed content. getBlob() therefore throws LayerPropertyNotFoundException.

Source

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

  private final BlobDescriptor blobDescriptor;

  /** The digest of the uncompressed layer content. */
  private final DescriptorDigest diffId;

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

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

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

  @Override
  public DescriptorDigest getDiffId() {
    return diffId;
  }
}

View on GitHub (pinned to fb949e2676)

Solutions

  1. Fetch the blob content from the registry (RegistryClient layer pull) using the layer digest instead of getBlob()
  2. Use a CachedLayer from the layer cache when local content is needed
  3. Guard with instanceof checks and only call getBlob() on layers that carry content

Example fix

// before
Blob blob = layer.getBlob();
// after
if (layer instanceof CachedLayer) {
  Blob blob = ((CachedLayer) layer).getBlob();
} else {
  DescriptorDigest digest = layer.getBlobDescriptor().getDigest();
}
Defensive patterns

Strategy: type-guard

Validate before calling

boolean canGetBlob = layer instanceof CachedLayer;

Type guard

boolean hasBlobContent(Layer l) { return l instanceof CachedLayer; }

Try / catch

try { Blob b = layer.getBlob(); } catch (LayerPropertyNotFoundException e) { pullBlobFromRegistry(layer.getBlobDescriptor().getDigest()); }

Prevention

When it happens

Trigger: Calling Layer.getBlob() on a ReferenceLayer created via ReferenceLayer.of(blobDescriptor, diffId) or returned by JsonToImageTranslator.toImage.

Common situations: Pulling an image via the registry API and then trying to stream layer blobs from the in-memory Image object; migrating manifests where content was never downloaded; tests assuming getBlob() works on all layers.

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/27bfe6d890b172ed. Report an issue: GitHub.