{"record":{"id":"a633a4b3648922ce","repo":"quarkusio/quarkus","slug":"could-not-reflectively-call-jibcontainerbuilder-co","errorCode":null,"errorMessage":"Could not reflectively call JibContainerBuilder constructor","messagePattern":"Could not reflectively call JibContainerBuilder constructor","errorType":"console","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java","lineNumber":993,"sourceCode":"        } catch (Exception e) {\n            log.error(\"Unable to build AOT enhanced container image for original \" + baseImage, e);\n            throw new RuntimeException(e);\n        }\n    }\n\n    // we need this horrible back because of https://github.com/GoogleContainerTools/jib/issues/4134\n    public JibContainerBuilder createPatchedInstance(ContainerImageJibConfig jibConfig, String baseImage) {\n        try {\n            Constructor<JibContainerBuilder> constructor = JibContainerBuilder.class.getDeclaredConstructor(\n                    ImageConfiguration.class,\n                    BuildContext.Builder.class);\n            constructor.setAccessible(true);\n            ImageConfiguration imageConfiguration = ImageConfiguration.builder(ImageReference.parse(baseImage))\n                    .setDockerClient(new PatchedDockerCliClient(determineDockerExecutable(jibConfig), Collections.emptyMap()))\n                    .build();\n            return constructor.newInstance(imageConfiguration, BuildContext.builder());\n        } catch (Exception e) {\n            throw new RuntimeException(\"Could not reflectively call JibContainerBuilder constructor\", e);\n        }\n    }\n\n    private static class PatchedDockerCliClient extends CliDockerClient {\n\n        public PatchedDockerCliClient(Path dockerExecutable, Map<String, String> dockerEnvironment) {\n            super(dockerExecutable, dockerEnvironment);\n        }\n\n        @Override\n        public DockerImageDetails inspect(ImageReference imageReference) throws IOException, InterruptedException {\n            return new PatchedDockerImageDetails(super.inspect(imageReference));\n        }\n\n        private static class PatchedDockerImageDetails extends DockerImageDetails {\n\n            /** Pattern matches a SHA-256 hash - 32 bytes in lowercase hexadecimal. */\n            private static final String HASH_REGEX = String.format(\"[a-f0-9]{%d}\", 64);","sourceCodeStart":975,"sourceCodeEnd":1011,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java#L975-L1011","documentation":"When the Jib 'docker' build strategy is used, Quarkus creates a JibContainerBuilder for docker-daemon builds via reflection into Jib internals (a constructor taking ImageConfiguration and BuildContext, to work around Jib API limits). If the reflective lookup/instantiation fails for any reason (Jib version change, constructor not found, InvocationTargetException from the docker client setup), it throws RuntimeException(\"Could not reflectively call JibContainerBuilder constructor\").","triggerScenarios":"quarkus.container-image.builder=jib with quarkus.jib.base-registry... / docker build mode; JibConstructors.resolve fails or constructor.newInstance(imageConfiguration, BuildContext.builder()) throws — most often because the quarkus-jib version was upgraded and Jib's internal constructor signature changed, or the docker CLI/determinable docker environment throws during ImageConfiguration building.","commonSituations":"Quarkus upgrade pulling a newer Jib whose internals no longer match ( NoSuchMethodException/IllegalAccessException wrapped), docker executable not found when determineDockerExecutable runs, patching of the docker CLI client failing in restricted environments.","solutions":["Check the full cause: NoSuchMethodException means a Quarkus/Jib version mismatch — align quarkus container-image-jib with the Quarkus BOM (do not pin a custom Jib version)","Upgrade/downgrade Quarkus to a version where the Jib integration matches the Jib dependency","If a custom Jib version is forced in dependencyManagement, remove the override","As a workaround use builder=docker for daemon builds, or fix the docker executable resolution (quarkus.jib.docker-executable-name / DOCKER_HOST env)"],"exampleFix":"// before: pom.xml overrides Jib, breaking reflective wiring\n<dependency><groupId>com.google.cloud.tools</groupId><artifactId>jib-core</artifactId><version>0.20.0</version></dependency>\n// after: let Quarkus manage the Jib version\n<!-- remove the explicit jib-core version override -->","handlingStrategy":"try-catch","validationCode":"// confirm Quarkus and Jib versions are aligned before the build\nString quarkusVersion = io.quarkus.runtime.util.ClassUtil.class == null ? null : null;\n// simpler: check jib-core on the classpath matches what the quarkus BOM manages\nvar mvn = new ProcessBuilder(\"mvn\", \"dependency:tree\", \"-Dincludes=com.google.cloud.tools:jib-core\").inheritIO().start();","typeGuard":null,"tryCatchPattern":"try {\n    dockerDaemonBuild();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Could not reflectively call JibContainerBuilder\")) {\n        throw new IllegalStateException(\"Quarkus/Jib version mismatch or docker env issue; see cause: \" + e.getCause(), e);\n    }\n    throw e;\n}","preventionTips":["Do not override Jib dependency versions managed by the Quarkus BOM","Upgrade Quarkus and its container-image extensions together","Ensure the docker CLI is on PATH or set quarkus.jib.docker-executable-name","Set DOCKER_HOST correctly when using a remote daemon"],"tags":["jib","reflection","docker","version-mismatch"],"backgroundTag":"reflective-call-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}