quarkusio/quarkus · error · BuildException

Multiple extensions request different distributions of Elast

Error message

Multiple extensions request different distributions of Elasticsearch for Dev Services.

What it means

In the same aggregation loop, if two extensions request different distributions (ELASTIC vs OPENSEARCH) for the shared Dev Services container, the processor cannot pick one and throws a BuildException. Only one Dev Services search container is started, so all contributions must agree on the distribution.

Source

Thrown at extensions/elasticsearch-rest-client-common/deployment/src/main/java/io/quarkus/elasticsearch/restclient/common/deployment/DevServicesElasticsearchProcessor.java:318

    private static DevservicesElasticsearchBuildItemsConfiguration aggregateBuildItems(
            List<DevservicesElasticsearchBuildItem> devservicesElasticsearchBuildItems) throws BuildException {
        Set<String> hostsConfigProperties = new HashSet<>(devservicesElasticsearchBuildItems.size());
        String version = null;
        Distribution distribution = null;

        for (DevservicesElasticsearchBuildItem buildItem : devservicesElasticsearchBuildItems) {
            if (version == null) {
                version = buildItem.getVersion();
            } else if (buildItem.getVersion() != null && !version.equals(buildItem.getVersion())) {
                throw new BuildException(
                        "Multiple extensions request different versions of Elasticsearch for Dev Services.",
                        Collections.emptyList());
            }

            if (distribution == null) {
                distribution = buildItem.getDistribution();
            } else if (buildItem.getDistribution() != null && !distribution.equals(buildItem.getDistribution())) {
                throw new BuildException(
                        "Multiple extensions request different distributions of Elasticsearch for Dev Services.",
                        Collections.emptyList());
            }

            hostsConfigProperties.add(buildItem.getHostsConfigProperty());
        }

        return new DevservicesElasticsearchBuildItemsConfiguration(hostsConfigProperties, version, distribution);
    }

    private record DevservicesElasticsearchBuildItemsConfiguration(
            Set<String> hostsConfigProperties, String version, Distribution distribution) {
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Remove or reconfigure the extension requesting the other distribution so all contributions agree
  2. Keep only one family of search extensions (all Elastic or all OpenSearch)
  3. Disable Dev Services for Elasticsearch and point both clients at a manually started instance

Example fix

// before: quarkus-elasticsearch (ELASTIC) + custom-search extension (OPENSEARCH)
// after: remove custom-search extension or change its build item to Distribution.ELASTIC
Defensive patterns

Strategy: validation

Validate before calling

// ensure all search extensions target the same distribution
// either all Elastic or all OpenSearch, else disable dev services:
quarkus.elasticsearch.devservices.enabled=false
quarkus.elasticsearch.hosts=localhost:9200

Prevention

When it happens

Trigger: One extension produces a DevservicesElasticsearchBuildItem with distribution ELASTIC while another produces OPENSEARCH, e.g. mixing quarkus-elasticsearch-* with an OpenSearch-oriented extension.

Common situations: Adding an OpenSearch-compatible extension to an app that already uses the Elasticsearch extension; a custom extension hard-coding OPENSEARCH while the default is ELASTIC.

Related errors


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