quarkusio/quarkus · error · IllegalArgumentException
Unsupported Java version:
Error message
Unsupported Java version:
What it means
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.
Source
Thrown at extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/ContainerImageOpenshiftConfig.java:38
public static final String DEFAULT_NATIVE_TARGET_FILENAME = "application";
public static final String DEFAULT_JVM_DOCKERFILE = "src/main/docker/Dockerfile.jvm";
public static final String DEFAULT_NATIVE_DOCKERFILE = "src/main/docker/Dockerfile.native";
public static final String DEFAULT_BUILD_LOG_LEVEL = "INFO";
public static final String FALLBACK_JAR_DIRECTORY = "/deployments/";
public static final String FALLBACK_NATIVE_BINARY_DIRECTORY = "/home/quarkus/";
public static String getDefaultJvmImage(CompiledJavaVersionBuildItem.JavaVersion version) {
if (version.isJava25OrHigher() == CompiledJavaVersionBuildItem.JavaVersion.Status.TRUE) {
return ContainerImages.S2I_JAVA_25;
}
if (version.isJava21OrHigher() == CompiledJavaVersionBuildItem.JavaVersion.Status.TRUE) {
return ContainerImages.S2I_JAVA_21;
}
throw new IllegalArgumentException("Unsupported Java version: " + version);
}
/**
* The build config strategy to use.
*/
@WithDefault("binary")
BuildStrategy buildStrategy();
/**
* The base image to be used when a container image is being produced for the jar build.
* The value of this property is used to create an ImageStream for the builder image used in the OpenShift build.
* When it references images already available in the internal OpenShift registry, the corresponding streams are used
* instead.
* When the application is built against Java 25 or higher, {@code registry.access.redhat.com/ubi10/openjdk-25:1.24}
* is used as the default.
* Otherwise {@code registry.access.redhat.com/ubi10/openjdk-21:1.24} is used as the default.
*/
Optional<String> baseJvmImage();View on GitHub (pinned to e1c734241f)
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.
Example fix
// before (pom.xml) <properties><maven.compiler.release>17</maven.compiler.release></properties> // after <properties><maven.compiler.release>21</maven.compiler.release></properties>
Defensive patterns
Strategy: validation
Validate before calling
int javaVersion = Runtime.version().feature(); // or read from build config
if (javaVersion < 21) {
throw new IllegalStateException("OpenShift S2I image build requires Java 21+; current: " + javaVersion);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Error creating the openshift binary build archive.
- Build:%s failed! %s
- @OnPingMessage callback must return void or Uni<Void>:
- Failed to open path tree with root %s
- Dev services for ${request.getName()} requires a startable s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/19824dca42cf0a70.
Report an issue: GitHub.