{"record":{"id":"19824dca42cf0a70","repo":"quarkusio/quarkus","slug":"unsupported-java-version","errorCode":null,"errorMessage":"Unsupported Java version: ","messagePattern":"Unsupported Java version: ","errorType":"console","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/ContainerImageOpenshiftConfig.java","lineNumber":38,"sourceCode":"\n    public static final String DEFAULT_NATIVE_TARGET_FILENAME = \"application\";\n\n    public static final String DEFAULT_JVM_DOCKERFILE = \"src/main/docker/Dockerfile.jvm\";\n    public static final String DEFAULT_NATIVE_DOCKERFILE = \"src/main/docker/Dockerfile.native\";\n\n    public static final String DEFAULT_BUILD_LOG_LEVEL = \"INFO\";\n\n    public static final String FALLBACK_JAR_DIRECTORY = \"/deployments/\";\n    public static final String FALLBACK_NATIVE_BINARY_DIRECTORY = \"/home/quarkus/\";\n\n    public static String getDefaultJvmImage(CompiledJavaVersionBuildItem.JavaVersion version) {\n        if (version.isJava25OrHigher() == CompiledJavaVersionBuildItem.JavaVersion.Status.TRUE) {\n            return ContainerImages.S2I_JAVA_25;\n        }\n        if (version.isJava21OrHigher() == CompiledJavaVersionBuildItem.JavaVersion.Status.TRUE) {\n            return ContainerImages.S2I_JAVA_21;\n        }\n        throw new IllegalArgumentException(\"Unsupported Java version: \" + version);\n    }\n\n    /**\n     * The build config strategy to use.\n     */\n    @WithDefault(\"binary\")\n    BuildStrategy buildStrategy();\n\n    /**\n     * The base image to be used when a container image is being produced for the jar build.\n     * The value of this property is used to create an ImageStream for the builder image used in the OpenShift build.\n     * When it references images already available in the internal OpenShift registry, the corresponding streams are used\n     * instead.\n     * When the application is built against Java 25 or higher, {@code registry.access.redhat.com/ubi10/openjdk-25:1.24}\n     * is used as the default.\n     * Otherwise {@code registry.access.redhat.com/ubi10/openjdk-21:1.24} is used as the default.\n     */\n    Optional<String> baseJvmImage();","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/ContainerImageOpenshiftConfig.java#L20-L56","documentation":"Quarkus's OpenShift container-image extension selects an S2I (source-to-image) builder image based on the compiled Java version of the application. getDefaultJvmImage maps Java 21+ and Java 25+ to the corresponding java-runtimes S2I image constants; if the detected version matches neither predicate, it throws IllegalArgumentException, meaning the compiler level is not one the extension can pick a base image for.","triggerScenarios":"Building an OpenShift container image (quarkus.openshift.* build, s2i strategy) while the application is compiled with a Java version that is neither >=21 nor >=25 (e.g. Java 17 or an unrecognized/unknown CompiledJavaVersionBuildItem status), so neither branch returns an S2I image and the fallthrough throw executes.","commonSituations":"Projects still targeting Java 17 after the extension dropped Java 17/11 S2I images; a custom toolchain/compile-time release property set below the supported minimum; building with a JDK whose version cannot be resolved at build time.","solutions":["Upgrade the application to compile with Java 21 or newer (set maven.compiler.release/java.version to 21+ and build with a compatible JDK).","If you must stay on an older Java version, pin an explicit base image instead of the default JVM image (e.g. set the custom s2i builder image in quarkus.openshift.*) or downgrade to a Quarkus version that still ships an S2I image for your Java version.","Verify the detected Java version by checking the build log (CompiledJavaVersionBuildItem) and ensure the JDK running the build matches the intended release.","If you believe your version should be supported, update the Quarkus version so ContainerImages includes the newer S2I constant for your Java release."],"exampleFix":"// before (pom.xml)\n<properties><maven.compiler.release>17</maven.compiler.release></properties>\n\n// after\n<properties><maven.compiler.release>21</maven.compiler.release></properties>","handlingStrategy":"validation","validationCode":"int javaVersion = Runtime.version().feature(); // or read from build config\nif (javaVersion < 21) {\n    throw new IllegalStateException(\"OpenShift S2I image build requires Java 21+; current: \" + javaVersion);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin maven.compiler.release/java.version to 21 or newer in the build.","Build with a JDK that matches the configured release so the detected version is accurate.","Before upgrading Quarkus, check the OpenShift extension docs for the minimum supported Java version.","In CI, assert the Java toolchain version before image build steps."],"tags":["java","openshift","s2i","container-image","build-time"],"backgroundTag":"unsupported-java-version","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}