quarkusio/quarkus · error · GradleException
Failed to add extensions + getExtensionsToAdd()
Error message
Failed to add extensions + getExtensionsToAdd()
What it means
Thrown by QuarkusAddExtension.addExtension() as a wrapper when executing the AddExtensions command (which modifies the build file to add extension dependencies) fails for any reason. The original exception is attached as the cause; the message includes the extensions that were requested.
Source
Thrown at devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusAddExtension.java:49
@Input
public List<String> getExtensionsToAdd() {
return extensionsToAdd;
}
@TaskAction
public void addExtension() {
Set<String> extensionsSet = getExtensionsToAdd()
.stream()
.flatMap(ext -> stream(ext.split(",")))
.map(String::trim)
.collect(toSet());
try {
AddExtensions addExtensions = new AddExtensions(getQuarkusProject(false))
.extensions(extensionsSet);
addExtensions.execute();
} catch (Exception e) {
throw new GradleException("Failed to add extensions " + getExtensionsToAdd(), e);
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Inspect the 'Caused by' in the stack trace to see the underlying failure
- Add the dependency manually in build.gradle(.kts), e.g. implementation("io.quarkus:quarkus-cache")
- Verify the extension name/coordinates are valid (use the Quarkus registry) and that build files are writable
Example fix
// before: gradle addExtension --extensions=quarkus-not-a-real-ext -> GradleException
// after: add manually in build.gradle
dependencies { implementation("io.quarkus:quarkus-cache") } Defensive patterns
Strategy: try-catch
Validate before calling
// ensure extension name is valid before running the task
if (!extName.matches(Regex("quarkus-[a-z0-9-]+")))
throw IllegalArgumentException("Invalid extension id: $extName") Try / catch
task 'addExtension' fails with GradleException('Failed to add extensions ...'):
// read e.cause (or the 'Caused by:' block) to decide between
// manual dependency add vs fixing file permissions/coordinates Prevention
- Check the 'Caused by' root cause before retrying
- Keep build scripts in a format the tool can rewrite (standard dependencies block)
- Ensure build files are writable in CI containers
When it happens
Trigger: Running gradle addExtension --extensions=... when the build script cannot be parsed/modified (unsupported build script format, version catalog or unusual dependency syntax, read-only files, or an invalid extension coordinates string).
Common situations: Using addExtension in projects with build.gradle.kts constructs the tool cannot rewrite; offline/invalid artifact coordinates causing resolution failure; permission problems on build files in CI containers.
Related errors
- Failed to resolve ${appArtifact}
- Requested artifact ${appArtifact} does not match project ${g
- No platforms detected in the project
- Failed to determine the Quarkus core version for the project
- Failed to configure ${taskPath}: sourceSet ${sourceSet} has
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/a15e7823848e1001.
Report an issue: GitHub.