{"record":{"id":"6b0992930d5d4303","repo":"quarkusio/quarkus","slug":"two-vertxoptionsconsumerbuilditem-instances-have-t","errorCode":null,"errorMessage":"Two VertxOptionsConsumerBuildItem instances have the same priority and orderKey, which is not allowed. First instance: [priority: ${priority}, orderKey: ${orderKey}], second instance: [priority: ${otherPriority}, orderKey: ${otherOrderKey}]","messagePattern":"Two VertxOptionsConsumerBuildItem instances have the same priority and orderKey, which is not allowed\\. First instance: \\[priority: (.+?), orderKey: (.+?)\\], second instance: \\[priority: (.+?), orderKey: (.+?)\\]","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/vertx/deployment-spi/src/main/java/io/quarkus/vertx/deployment/spi/VertxOptionsConsumerBuildItem.java","lineNumber":51,"sourceCode":"    }\n\n    public Consumer<VertxOptions> getConsumer() {\n        return consumer;\n    }\n\n    @Override\n    public int compareTo(VertxOptionsConsumerBuildItem o) {\n        if (this == o) {\n            return 0;\n        }\n        int result = Integer.compare(this.priority, o.priority);\n        if (result != 0) {\n            return result;\n        }\n        result = this.orderKey.compareTo(o.orderKey);\n\n        if (result == 0) {\n            throw new IllegalStateException(\n                    \"Two VertxOptionsConsumerBuildItem instances have the same priority and orderKey, which is not allowed. \"\n                            + \"First instance: [priority: \" + this.priority + \", orderKey: \" + this.orderKey + \"], \"\n                            + \"second instance: [priority: \" + o.priority + \", orderKey: \" + o.orderKey + \"]\");\n        }\n        return result;\n    }\n}\n","sourceCodeStart":33,"sourceCodeEnd":59,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/vertx/deployment-spi/src/main/java/io/quarkus/vertx/deployment/spi/VertxOptionsConsumerBuildItem.java#L33-L59","documentation":"VertxOptionsConsumerBuildItem implements Comparable: items are sorted by priority then orderKey. If two items have both the same priority and orderKey, ordering is ambiguous and compareTo throws IllegalStateException listing both conflicting [priority, orderKey] pairs.","triggerScenarios":"The Vert.x deployment sorts the collected VertxOptionsConsumerBuildItem list and encounters two items with equal priority and identical orderKey — usually two extensions or build steps reusing the same key.","commonSituations":"Copy-pasted build-item code across extensions; duplicate registrations after merging feature branches; a shared library and application both registering with the same default key.","solutions":["Rename one item's orderKey to a unique value (include the extension/feature name)","Change priority values where genuinely different ordering is intended","Search the build for all productions of VertxOptionsConsumerBuildItem and make (priority, orderKey) pairs unique","Document key naming conventions to prevent future collisions"],"exampleFix":"// before\nnew VertxOptionsConsumerBuildItem(c, 50, \"options\");\nnew VertxOptionsConsumerBuildItem(c2, 50, \"options\");\n\n// after\nnew VertxOptionsConsumerBuildItem(c, 50, \"ext-a-options\");\nnew VertxOptionsConsumerBuildItem(c2, 50, \"ext-b-options\");","handlingStrategy":"validation","validationCode":"Set<String> keys = new HashSet<>();\nfor (var item : items) {\n    if (!keys.add(item.priority + \":\" + item.orderKey)) {\n        throw new IllegalStateException(\"Duplicate VertxOptionsConsumerBuildItem priority+orderKey: \" + item.orderKey);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    items.sort(null); // triggers compareTo conflict detection\n} catch (IllegalStateException e) {\n    throw new IllegalStateException(\"Rename conflicting orderKey\", e);\n}","preventionTips":["Namespace orderKeys with extension/feature names","Keep a central registry of (priority, orderKey) pairs in your project","Search for duplicate VertxOptionsConsumerBuildItem productions when merging branches"],"tags":["quarkus","vertx","build-spi","ordering-conflict","duplicates"],"backgroundTag":"duplicate-build-item-order-key","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"}