{"record":{"id":"1df434a63e97b949","repo":"quarkusio/quarkus","slug":"multiple-extensions-request-different-distribution","errorCode":null,"errorMessage":"Multiple extensions request different distributions of Elasticsearch for Dev Services.","messagePattern":"Multiple extensions request different distributions of Elasticsearch for Dev Services\\.","errorType":"exception","errorClass":"BuildException","httpStatus":null,"severity":"error","filePath":"extensions/elasticsearch-rest-client-common/deployment/src/main/java/io/quarkus/elasticsearch/restclient/common/deployment/DevServicesElasticsearchProcessor.java","lineNumber":318,"sourceCode":"    private static DevservicesElasticsearchBuildItemsConfiguration aggregateBuildItems(\n            List<DevservicesElasticsearchBuildItem> devservicesElasticsearchBuildItems) throws BuildException {\n        Set<String> hostsConfigProperties = new HashSet<>(devservicesElasticsearchBuildItems.size());\n        String version = null;\n        Distribution distribution = null;\n\n        for (DevservicesElasticsearchBuildItem buildItem : devservicesElasticsearchBuildItems) {\n            if (version == null) {\n                version = buildItem.getVersion();\n            } else if (buildItem.getVersion() != null && !version.equals(buildItem.getVersion())) {\n                throw new BuildException(\n                        \"Multiple extensions request different versions of Elasticsearch for Dev Services.\",\n                        Collections.emptyList());\n            }\n\n            if (distribution == null) {\n                distribution = buildItem.getDistribution();\n            } else if (buildItem.getDistribution() != null && !distribution.equals(buildItem.getDistribution())) {\n                throw new BuildException(\n                        \"Multiple extensions request different distributions of Elasticsearch for Dev Services.\",\n                        Collections.emptyList());\n            }\n\n            hostsConfigProperties.add(buildItem.getHostsConfigProperty());\n        }\n\n        return new DevservicesElasticsearchBuildItemsConfiguration(hostsConfigProperties, version, distribution);\n    }\n\n    private record DevservicesElasticsearchBuildItemsConfiguration(\n            Set<String> hostsConfigProperties, String version, Distribution distribution) {\n    }\n}\n","sourceCodeStart":300,"sourceCodeEnd":333,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/elasticsearch-rest-client-common/deployment/src/main/java/io/quarkus/elasticsearch/restclient/common/deployment/DevServicesElasticsearchProcessor.java#L300-L333","documentation":"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.","triggerScenarios":"One extension produces a DevservicesElasticsearchBuildItem with distribution ELASTIC while another produces OPENSEARCH, e.g. mixing quarkus-elasticsearch-* with an OpenSearch-oriented extension.","commonSituations":"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.","solutions":["Remove or reconfigure the extension requesting the other distribution so all contributions agree","Keep only one family of search extensions (all Elastic or all OpenSearch)","Disable Dev Services for Elasticsearch and point both clients at a manually started instance"],"exampleFix":"// before: quarkus-elasticsearch (ELASTIC) + custom-search extension (OPENSEARCH)\n// after: remove custom-search extension or change its build item to Distribution.ELASTIC","handlingStrategy":"validation","validationCode":"// ensure all search extensions target the same distribution\n// either all Elastic or all OpenSearch, else disable dev services:\nquarkus.elasticsearch.devservices.enabled=false\nquarkus.elasticsearch.hosts=localhost:9200","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize on one distribution family across all search extensions","Check extension docs for which Distribution their build item requests","Use a manually started instance when mixing clients"],"tags":["devservices","elasticsearch","opensearch","build-time"],"backgroundTag":"ambiguous-image-distribution","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}