quarkusio/quarkus · error · RuntimeException
mongo config is missing for creating mongo client.
Error message
mongo config is missing for creating mongo client.
What it means
createMongoConfiguration is a private internal helper that must always receive a MongoClientConfig from the mongoConfig.clients() map; this RuntimeException is a defensive assertion that fires only if the config lookup returned null despite a client being requested.
Source
Thrown at extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/MongoClients.java:320
private static class ServerSettingsBuilder implements Block<ServerSettings.Builder> {
public ServerSettingsBuilder(MongoClientConfig config) {
this.config = config;
}
private final MongoClientConfig config;
@Override
public void apply(ServerSettings.Builder builder) {
if (config.heartbeatFrequency().isPresent()) {
builder.heartbeatFrequency((int) config.heartbeatFrequency().get().toMillis(), TimeUnit.MILLISECONDS);
}
}
}
private MongoClientSettings createMongoConfiguration(final MongoClientConfig config, final String name,
final boolean isReactive) {
if (config == null) {
throw new RuntimeException("mongo config is missing for creating mongo client.");
}
CodecRegistry defaultCodecRegistry = MongoClientSettings.getDefaultCodecRegistry();
MongoClientSettings.Builder settings = MongoClientSettings.builder();
if (isReactive) {
switch (config.reactiveTransport()) {
case NETTY:
// we supports just NIO for now
if (!vertx.isNativeTransportEnabled()) {
configureNettyTransport(settings);
}
break;
case MONGO:
// no-op since this is the default behaviour
break;
}
reactiveContextProviders.stream().findAny().ifPresent(settings::contextProvider);View on GitHub (pinned to e1c734241f)
Solutions
- Set `quarkus.mongodb.connection-string` (default client) or `quarkus.mongodb.<name>.connection-string` (named client)
- Check that the client name passed to the lookup matches the configured prefix exactly
- Ensure MongoConfigLocation/mongo configuration is loaded before the client is created (don't build clients during early startup phases without config)
Example fix
// before: missing config // (no quarkus.mongodb.* properties) // after quarkus.mongodb.connection-string=mongodb://localhost:27017
Defensive patterns
Strategy: validation
Validate before calling
// Ensure required Mongo config is present before startup
if (!ConfigProvider.getConfig().getPropertyNames().stream()
.anyMatch(p -> p.startsWith("quarkus.mongodb"))) {
throw new ConfigurationException("No quarkus.mongodb.* configuration found");
} Prevention
- Always define quarkus.mongodb.connection-string or a named client config in every profile
- Match client names exactly between injection points and configuration prefixes
- Add a startup smoke test that builds all clients in CI
When it happens
Trigger: An internal path resolves a client name that is absent from `quarkus.mongodb.clients` (e.g. extension code requesting a default client when no quarkus.mongodb.* properties exist, or a name mismatch between injector and config).
Common situations: No MongoDB connection URL configured at all while code still triggers client creation; a named client referenced but its `quarkus.mongodb.<name>.connection-string` missing; custom extension code calling MongoClients with a stale client name.
Related errors
- Mongo client named '%s' not found
- The database was not configured for the default Mongo Client
- 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/00e8ae4357e622d7.
Report an issue: GitHub.