quarkusio/quarkus · error · MojoExecutionException

Unable to add extensions

Error message

Unable to add extensions

What it means

AddExtensionMojo.doExecute throws this when the AddExtensions QuarkusCommandOutcome reports failure — the command ran but could not add the requested extensions (e.g. unknown extension artifact IDs). It is the failure branch distinct from the exception path which produces 'Unable to update the pom.xml file'.

Source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/AddExtensionMojo.java:65

    @Override
    public void doExecute(final QuarkusProject quarkusProject, final MessageWriter log)
            throws MojoExecutionException {
        Set<String> ext = new HashSet<>();
        if (extensions != null && !extensions.isEmpty()) {
            ext.addAll(extensions);
        } else {
            // Parse the "extension" just in case it contains several comma-separated values
            // https://github.com/quarkusio/quarkus/issues/2393
            ext.addAll(Arrays.stream(extension.split(",")).map(String::trim).collect(toSet()));
        }

        try {
            AddExtensions addExtensions = new AddExtensions(quarkusProject)
                    .extensions(ext.stream().map(String::trim).collect(toSet()));
            final QuarkusCommandOutcome outcome = addExtensions.execute();
            if (!outcome.isSuccess()) {
                throw new MojoExecutionException("Unable to add extensions");
            }
        } catch (Exception e) {
            throw new MojoExecutionException("Unable to update the pom.xml file", e);
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Verify extension artifactIds with `mvn quarkus:list-extensions` and correct typos.
  2. Check the full log output above the error for which extension failed.
  3. Ensure network access to the extension registry and correct quarkus platform/BOM version.

Example fix

// before
mvn quarkus:add-extension -Dextensions=postgres
// after
mvn quarkus:add-extension -Dextensions=quarkus-jdbc-postgresql
Defensive patterns

Strategy: validation

Validate before calling

mvn quarkus:list-extensions | grep -i <artifactId>   # verify the extension exists before adding

Try / catch

try { ... } catch (MojoExecutionException e) { log.error('Extension add failed: check artifactIds with quarkus:list-extensions'); }

Prevention

When it happens

Trigger: addExtensions.execute() returns outcome.isSuccess() == false, typically because one or more extension artifactIds were not found in the registry/catalog.

Common situations: Misspelled or wrong extension artifactId (e.g. 'postgres' instead of 'quarkus-jdbc-postgresql'); offline environment where the registry cannot be queried; project not recognized as a Quarkus project.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/b726f5266a4e228b. Report an issue: GitHub.