quarkusio/quarkus · error · RuntimeException

Failed to read imageId

Error message

Failed to read imageId

What it means

The patched DockerImageDetails implementation reads the private 'imageId' field of Jib's DockerImageDetails via reflection. If Jib's internal field is renamed/moved (version drift) or access is blocked, Quarkus throws RuntimeException("Failed to read imageId", e). It is a compatibility failure between Quarkus' reflection shim and the bundled Jib version, not a docker problem.

Source

Thrown at extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java:1052

            @Override
            public long getSize() {
                return delegate.getSize();
            }

            // this is method we actually need to override
            @Override
            public DescriptorDigest getImageId() throws DigestException {
                return fromDigestOrHash(getPrivateImageId());
            }

            private String getPrivateImageId() {
                try {
                    Field field = DockerImageDetails.class.getDeclaredField("imageId");
                    field.setAccessible(true);
                    return (String) field.get(delegate);

                } catch (NoSuchFieldException | IllegalAccessException e) {
                    throw new RuntimeException("Failed to read imageId", e);
                }
            }

            @Override
            public List<DescriptorDigest> getDiffIds() throws DigestException {
                return delegate.getDiffIds();
            }
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Align the Jib version with the one Quarkus manages — remove any jib-core/jib-maven-plugin version overrides from your pom
  2. Upgrade Quarkus to a patch release where the reflection shim matches the bundled Jib
  3. Check the cause: NoSuchFieldException 'imageId' ⇒ version drift; IllegalAccessException ⇒ module/SecurityManager restriction
  4. Workaround: build without daemon inspection (push straight to a registry or use builder=docker without digest lookups)

Example fix

// before: pom.xml pins jib-core to an older/newer version than Quarkus expects
<jib-core.version>0.27.0</jib-core.version>
// after: remove the property so the Quarkus BOM manages it
<!-- delete the jib-core.version property override -->
Defensive patterns

Strategy: try-catch

Validate before calling

// fail fast on Jib version drift: assert the expected private field exists
try {
    Class<?> d = Class.forName("com.google.cloud.tools.jib.frontend.DockerImageDetails");
    d.getDeclaredField("imageId");
} catch (ReflectiveOperationException e) {
    throw new IllegalStateException("Jib version incompatible with Quarkus image-details shim", e);
}

Try / catch

try {
    dockerBuildWithDetails();
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().contains("Failed to read imageId")) {
        throw new IllegalStateException("Quarkus/Jib incompatibility — remove custom jib-core version pins", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Docker-daemon build mode (builder=jib, docker strategy) where the image details are inspected and getDigests/getImageId delegation falls back to the reflective private-field read; triggered by NoSuchFieldException or IllegalAccessException.

Common situations: Quarkus and Jib versions out of sync (custom dependencyManagement pinning jib-core), security manager or module restrictions blocking setAccessible, Quarkus upgrade regression.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/977c15cda075412e. Report an issue: GitHub.