quarkusio/quarkus · error · IllegalArgumentException
Unknown ExtensionDependency type: ${dependency.getClass().ge
Error message
Unknown ExtensionDependency type: ${dependency.getClass().getName()} What it means
createDeploymentDependency converts an ExtensionDependency into the actual Gradle Dependency to add to a deployment configuration. It handles exactly two subtypes: ProjectExtensionDependency and ArtifactExtensionDependency. Any other subclass hits the final throw, an IllegalArgumentException naming the concrete class. Since ExtensionDependency is internal tooling API, this indicates a new/unknown subtype introduced by a version mismatch or custom fork, or an unexpected object passed into the API.
Source
Thrown at devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/dependency/DependencyUtils.java:363
return list;
}
public static Dependency create(DependencyHandler dependencies, String conditionalDependency) {
final ArtifactCoords dependencyCoords = ArtifactCoords.fromString(conditionalDependency);
return dependencies.create(String.join(":", dependencyCoords.getGroupId(), dependencyCoords.getArtifactId(),
dependencyCoords.getVersion()));
}
public static Dependency createDeploymentDependency(
DependencyHandler dependencyHandler,
ExtensionDependency<?> dependency) {
if (dependency instanceof ProjectExtensionDependency ped) {
return createDeploymentProjectDependency(dependencyHandler, ped);
} else if (dependency instanceof ArtifactExtensionDependency aed) {
return createArtifactDeploymentDependency(dependencyHandler, aed);
}
throw new IllegalArgumentException("Unknown ExtensionDependency type: " + dependency.getClass().getName());
}
private static Dependency createDeploymentProjectDependency(DependencyHandler handler, ProjectExtensionDependency ped) {
if (ped.isIncludedBuild()) {
return new DefaultExternalModuleDependency(
ped.getDeploymentModule().getGroup().toString(),
ped.getDeploymentModule().getName(),
ped.getDeploymentModule().getVersion().toString());
} else {
return handler.create(handler.project(Map.of("path", ped.getDeploymentModule().getPath())));
}
}
private static Dependency createArtifactDeploymentDependency(DependencyHandler handler,
ArtifactExtensionDependency dependency) {
return handler.create(dependency.getDeploymentModule().getGroupId() + ":"
+ dependency.getDeploymentModule().getArtifactId() + ":"
+ dependency.getDeploymentModule().getVersion());View on GitHub (pinned to e1c734241f)
Solutions
- Align all Quarkus Gradle plugin artifacts to one version (./gradlew build with a single plugin version) to eliminate duplicate ExtensionDependency classes
- Check buildscript/classpath for multiple quarkus-gradle-model versions (./gradlew buildEnvironment) and exclude stale ones
- If you authored a custom subtype, extend createDeploymentDependency to handle it or convert it to one of the supported types
- Stop the daemon and clear configuration cache to drop stale plugin classes
- If it occurs with unmodified releases, report to Quarkus with the class name from the message
Example fix
// before (custom subtype)
class MyExtDependency implements ExtensionDependency<MyCfg> { ... }
createDeploymentDependency(handler, new MyExtDependency(...));
// after (convert to supported type)
ProjectExtensionDependency ped = toProjectExtensionDependency(myDep);
createDeploymentDependency(handler, ped); Defensive patterns
Strategy: type-guard
Validate before calling
if (!(dependency instanceof ProjectExtensionDependency) && !(dependency instanceof ArtifactExtensionDependency)) {
throw new IllegalStateException("Unsupported ExtensionDependency: " + dependency.getClass().getName());
} Type guard
static boolean supported(ExtensionDependency<?> d) {
return d instanceof ProjectExtensionDependency || d instanceof ArtifactExtensionDependency;
} Try / catch
try {
Dependency dep = DependencyUtils.createDeploymentDependency(handler, extDep);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Unknown ExtensionDependency type:")) {
// convert/handle the custom subtype before retrying
} else throw e;
} Prevention
- Do not create custom subclasses of ExtensionDependency
- Ensure only one version of quarkus-gradle-model is on the build classpath (check ./gradlew buildEnvironment)
- Convert third-party extension dependency representations into the two supported types first
- Stop the daemon and clear configuration cache after plugin version changes
When it happens
Trigger: Calling DependencyUtils.createDeploymentDependency(handler, dependency) with an ExtensionDependency instance that is neither ProjectExtensionDependency nor ArtifactExtensionDependency — e.g. a custom subclass or one produced by a differently-versioned gradle-model class.
Common situations: Mixing Quarkus Gradle plugin module versions (gradle-model vs plugin) so two different ExtensionDependency class hierarchies exist on the classpath; custom IDE tooling constructing its own ExtensionDependency implementation; forks that added a third subtype without updating this switch.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- both extensionConfiguration and extensionDescriptor are null
- Quarkus Extension Dependency Verification Error. See logs be
- Unexpected mode:
- Cannot find deployment project for extension ${extensionArti
- Cannot find deployment project for extension ${extensionArti
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/219c1fee17f51133.
Report an issue: GitHub.