GoogleContainerTools/jib · error · LayerPropertyNotFoundException

Blob not available for digest-only layer

Error message

Blob not available for digest-only layer

What it means

DigestOnlyLayer represents a layer known only by its digest (no blob content). Jib throws this LayerPropertyNotFoundException from getBlob() because there is no Blob backing a digest-only layer — only the digest is stored. Callers must not request content they never supplied.

Source

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

/** A {@link Layer} reference that only has its {@link DescriptorDigest}. */
public class DigestOnlyLayer implements Layer {

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

  /**
   * Instantiate with a {@link DescriptorDigest}.
   *
   * @param digest the digest to instantiate the {@link DigestOnlyLayer} from
   */
  public DigestOnlyLayer(DescriptorDigest digest) {
    blobDescriptor = new BlobDescriptor(digest);
  }

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

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

  @Override
  public DescriptorDigest getDiffId() throws LayerPropertyNotFoundException {
    throw new LayerPropertyNotFoundException("Diff ID not available for digest-only layer");
  }
}

View on GitHub (pinned to fb949e2676)

Solutions

  1. Do not call getBlob() on digest-only layers; check the concrete Layer type first and use getBlobDescriptor().getDigest() instead
  2. Use the layer cache (CachedLayer) or a Layer built from an actual Blob when blob content is needed
  3. Catch LayerPropertyNotFoundException around getBlob() when iterating heterogeneous layers

Example fix

// before
Blob blob = layer.getBlob();
// after
BlobDescriptor desc = layer.getBlobDescriptor();
// use desc.getDigest() for digest-only layers; only call getBlob() on cached layers
Defensive patterns

Strategy: type-guard

Validate before calling

// Java
boolean hasBlob = !(layer instanceof DigestOnlyLayer) && !(layer instanceof ReferenceLayer);

Type guard

boolean hasBlob(Layer l) { return l instanceof CachedLayer || l instanceof CountingDigestOutputWriter-bearing classes; }

Try / catch

try { Blob b = layer.getBlob(); } catch (LayerPropertyNotFoundException e) { /* fall back to getBlobDescriptor().getDigest() */ }

Prevention

When it happens

Trigger: Calling Layer.getBlob() on a layer obtained from an Image that was built with digests only (e.g. via JsonToImageTranslator.toImage or an Image built from a manifest), rather than a cached/compressed layer that carries blob data.

Common situations: Reading layers back from a parsed registry manifest and assuming each Layer exposes content; serializing/copying an image and attempting to re-upload layer blobs from the in-memory image; unit tests probing Layer API uniformly.

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/998bae43aeb1293f. Report an issue: GitHub.