quarkusio/quarkus · error · IllegalStateException

Two VertxBootstrapConsumerBuildItem instances have the same

Error message

Two VertxBootstrapConsumerBuildItem instances have the same priority and orderKey, which is not allowed. First instance: [priority: ${priority}, orderKey: ${orderKey}], second instance: [priority: ${otherPriority}, orderKey: ${otherOrderKey}]

What it means

VertxBootstrapConsumerBuildItem implements Comparable: consumers are first ordered by priority, then by orderKey. If two items share both the same priority and the same orderKey, deterministic ordering is impossible and compareTo throws IllegalStateException naming both conflicting instances.

Source

Thrown at extensions/vertx/deployment-spi/src/main/java/io/quarkus/vertx/deployment/spi/VertxBootstrapConsumerBuildItem.java:59

        return consumer;
    }

    @Override
    public int compareTo(VertxBootstrapConsumerBuildItem o) {
        if (this == o) {
            return 0;
        }
        int result = Integer.compare(this.priority, o.priority);
        if (result != 0) {
            return result;
        }
        Logger.getLogger(VertxBootstrapConsumerBuildItem.class).warnf(
                "Two VertxBootstrapConsumerBuildItem have the same priority (%d). The order of execution is not guaranteed. " +
                        "Consider using different priorities to ensure a deterministic order.",
                this.priority);
        result = this.orderKey.compareTo(o.orderKey);
        if (result == 0) {
            throw new IllegalStateException(
                    "Two VertxBootstrapConsumerBuildItem instances have the same priority and orderKey, which is not allowed. "
                            + "First instance: [priority: " + this.priority + ", orderKey: " + this.orderKey + "], "
                            + "second instance: [priority: " + o.priority + ", orderKey: " + o.orderKey + "]");
        }
        return result;
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Change one item's orderKey to a unique stable string (prefix with the extension name)
  2. Use a different priority value if ordering intent actually differs
  3. Audit your codebase for duplicate VertxBootstrapConsumerBuildItem productions
  4. Register ordering via documented conventions so keys don't collide across extensions

Example fix

// before (two places)
new VertxBootstrapConsumerBuildItem(c1, 100, "bootstrap");
new VertxBootstrapConsumerBuildItem(c2, 100, "bootstrap");

// after
new VertxBootstrapConsumerBuildItem(c1, 100, "ext-a-bootstrap");
new VertxBootstrapConsumerBuildItem(c2, 100, "ext-b-bootstrap");
Defensive patterns

Strategy: validation

Validate before calling

// ensure unique (priority, orderKey) pairs before producing items
Set<String> seen = new HashSet<>();
for (var item : items) {
    if (!seen.add(item.priority + ":" + item.orderKey)) {
        throw new IllegalStateException("Duplicate priority+orderKey: " + item.orderKey);
    }
}

Try / catch

try {
    Collections.sort(items);
} catch (IllegalStateException e) {
    throw new IllegalStateException("Fix duplicate VertxBootstrapConsumerBuildItem keys", e);
}

Prevention

When it happens

Trigger: Two extensions (or two build steps in one extension) produce VertxBootstrapConsumerBuildItem instances with equal priority and identical orderKey, then the deployment sorts them.

Common situations: Copy-pasting build-item creation code between extensions without changing the key; two features in the same extension reusing the default key; a version merge leaving duplicate registrations.

Related errors


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