Fetching manifest from ECR fails due to missing Docker-Content-Digest header

NullPointerException when fetching manifest from ECR

I am attempting to fetch an Manifest for a container image, and it is throwing a NullPointerException. I've reproduced this with a public ECR image here.

    Registry registry = Registry.builder().build();
    ContainerRef containerRef = ContainerRef.parse("public.ecr.aws/docker/library/alpine:latest");

    Index index = registry.getIndex(containerRef);
    String digest = index.getManifests().get(0).getDigest();
    Manifest manifest = registry.getManifest(containerRef.withDigest(digest));

fails with

Exception in thread "main" java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:209)
	at land.oras.ManifestDescriptor.of(ManifestDescriptor.java:202)
	at land.oras.ManifestDescriptor.of(ManifestDescriptor.java:191)
	at land.oras.Registry.getManifest(Registry.java:564)
	at test.EcrManifestTest.main(EcrManifestTest.java:33)

Debugging through the code I found that the getDescriptor call inside getManifest populates the digest based on the Docker-Content-Digest header value, which ECR doesn't seem to return. This results in the ManifestDescriptor.of call in getManifest to fail with the digest not null assertion at the beginning. Seems like the only headers its returning are,

headers = {HashMap@3651}  size = 4
 "date" -> "Fri, 06 Feb 2026 14:59:39 GMT"
 "docker-distribution-api-version" -> "registry/2.0"
 "content-type" -> "application/vnd.oci.image.index.v1+json"
 ":status" -> "200"

In this particular case, I already know the digest as well, as I've passed it in as part of the ContainerRef which probably can be set using that, but then it would be problematic if this is called with a container ref without a digest. Maybe if digest doesn't get returned, it could do a probe request to get the digest if the container ref doesn't have the digest in it?