GoogleContainerTools/jib · error · LayerPropertyNotFoundException

Diff ID not available for digest-only layer

Error message

Diff ID not available for digest-only layer

What it means

LayerPropertyNotFoundException thrown by DigestOnlyLayer.getDiffId(). A DigestOnlyLayer represents a layer reference known only by its digest (e.g. a layer pulled from a registry cache or referenced from a base image manifest) so it carries only a BlobDescriptor, never the uncompressed-layer diff ID. This is a deliberate sentinel guard: calling getDiffId() on such a reference is an API misuse because the value is structurally unavailable, not merely unloaded — the caller must obtain the diff ID from the layer's actual content or metadata instead.

Source

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

   * @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. Obtain diff IDs from the container configuration (JsonToImageTranslator pairs manifest layers with config diffIds) instead of the layer itself
  2. Use ReferenceLayer (built with a diffId) when diff IDs are required
  3. Catch LayerPropertyNotFoundException and treat the diff ID as unavailable

Example fix

// before
DescriptorDigest diffId = layer.getDiffId();
// after
try {
  DescriptorDigest diffId = layer.getDiffId();
} catch (LayerPropertyNotFoundException ex) { /* digest-only layer: no diff ID */ }
Defensive patterns

Strategy: try-catch

Validate before calling

// check availability: diff IDs live in the container config, not manifest layers
boolean hasDiffId = containerConfigurationTemplate != null && containerConfigurationTemplate.getDiffIds().size() == manifestTemplate.getLayers().size();

Try / catch

try { DescriptorDigest d = layer.getDiffId(); } catch (LayerPropertyNotFoundException e) { d = diffIdsFromConfig.get(index); }

Prevention

When it happens

Trigger: Calling Layer.getDiffId() on a DigestOnlyLayer, typically a layer built from a manifest template's descriptors where diff IDs were never provided.

Common situations: Reconstructing an image from a registry manifest without a container configuration (which is where diff IDs live); computing total image size/diff chains from manifest-only data; cache-key computations needing diff IDs.

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