quarkusio/quarkus · error · java.lang.IllegalStateException
Duplicate pool name:
Error message
Duplicate pool name:
What it means
ReactiveDatasourceHealthCheck aggregates one Vert.x pool per configured reactive datasource, keyed by datasource name. During initialization addPool() puts each pool into a map; if a second pool registers under a name already present, it throws IllegalStateException because health checks would collide and report ambiguous results.
Source
Thrown at extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/ReactiveDatasourceHealthCheck.java:44
private static final Logger log = Logger.getLogger(ReactiveDatasourceHealthCheck.class);
private final Map<String, PoolHealthEntry> pools = new ConcurrentHashMap<>();
private final String healthCheckResponseName;
private final String defaultHealthCheckSQL;
protected ReactiveDatasourceHealthCheck(String healthCheckResponseName, String defaultHealthCheckSQL) {
this.healthCheckResponseName = healthCheckResponseName;
this.defaultHealthCheckSQL = defaultHealthCheckSQL;
}
protected void addPool(String name, Pool pool) {
addPool(name, pool, defaultHealthCheckSQL);
}
protected void addPool(String name, Pool pool, String healthCheckSQL) {
final PoolHealthEntry previous = pools.put(name, new PoolHealthEntry(pool, healthCheckSQL));
if (previous != null) {
throw new IllegalStateException("Duplicate pool name: " + name);
}
}
@Override
public HealthCheckResponse call() {
HealthCheckResponseBuilder builder = HealthCheckResponse.named(healthCheckResponseName);
builder.up();
for (Map.Entry<String, PoolHealthEntry> poolEntry : pools.entrySet()) {
final String dataSourceName = poolEntry.getKey();
final PoolHealthEntry entry = poolEntry.getValue();
try {
CompletableFuture<Void> databaseConnectionAttempt = new CompletableFuture<>();
Context context = Vertx.currentContext();
if (context != null) {
log.debug("Run health check on the current Vert.x context");
context.runOnContext(v -> {
entry.pool.query(entry.healthCheckSQL)View on GitHub (pinned to e1c734241f)
Solutions
- Check application.properties for duplicate quarkus.datasource."<name>" blocks and make each datasource name unique
- If creating datasources programmatically, ensure each is added to the health check only once
- Review custom subclasses of ReactiveDatasourceHealthCheck for duplicate addPool calls
- Quarkus version-upgrade check: remove duplicate ReactiveDatasourceHealthCheck bean registrations (e.g. @Produces plus built-in)
Example fix
// before (duplicate names) quarkus.datasource."db".reactive.url=... quarkus.datasource."db".reactive.url=... // after quarkus.datasource."orders".reactive.url=... quarkus.datasource."users".reactive.url=...
Defensive patterns
Strategy: validation
Validate before calling
Set<String> names = new HashSet<>();
for (String ds : List.of("<ds1>", "<ds2>")) {
if (!names.add(ds)) throw new IllegalStateException("Duplicate datasource name: " + ds);
} Try / catch
try {
healthCheck.addPool(name, pool, sql);
} catch (IllegalStateException e) {
log.errorf("Duplicate pool registration: %s", e.getMessage());
throw e; // fail fast at startup
} Prevention
- Keep datasource names unique across application.properties
- Never re-add an existing pool name to a health check
- Watch for duplicated health check bean registrations in custom code
When it happens
Trigger: addPool() called twice with the same datasource name — typically two health-check instances or pool registrations for the same named datasource, or programmatic datasource creation reusing a name already registered.
Common situations: Registering multiple reactive datasources with duplicate quarkus.datasource."name" identifiers; custom code extending ReactiveDatasourceHealthCheck and re-adding a pool; extension re-initialization after config reload.
Related errors
- TLS configuration name '' is set but the TLS registry is not
- Unable to find the TLS configuration '' for the reactive dat
- Failed to load application configuration
- Failed to initialize application configuration
- Unrecognized option for quarkus.bootstrap.misaligned-platfor
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/15ee977fa1aa127f.
Report an issue: GitHub.