{"record":{"id":"ad0996f35179ae70","repo":"quarkusio/quarkus","slug":"mongo-client-named-s-not-found","errorCode":null,"errorMessage":"Mongo client named '%s' not found","messagePattern":"Mongo client named '(.+?)' not found","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/liquibase/liquibase-mongodb/runtime/src/main/java/io/quarkus/liquibase/mongodb/runtime/LiquibaseMongodbRecorder.java","lineNumber":62,"sourceCode":"\n            @Override\n            public LiquibaseMongodbFactory get() {\n                LiquibaseMongodbBuildTimeClientConfig buildTimeClientConfig = getRequiredConfig(\n                        buildTimeConfig.clientConfigs(),\n                        \"Liquibase Mongo config (changeLog) named '%s' not found\");\n\n                LiquibaseMongodbClientConfig liquibaseMongodbClientConfig = getRequiredConfig(\n                        runtimeConfig.getValue().clientConfigs(),\n                        \"Liquibase Mongo client config named '%s' not found\");\n\n                MongoClientConfig mongoClientConfig;\n                String clientNameSelected;\n                if (liquibaseMongodbClientConfig.mongoClientName().isPresent()) {\n                    // keep compatibility with the legacy configuration which makes possible set the mongo-client-name\n                    String forceMongoClientName = liquibaseMongodbClientConfig.mongoClientName().get();\n                    mongoClientConfig = mongodbRuntimeConfig.getValue().clients().get(forceMongoClientName);\n                    if (mongoClientConfig == null) {\n                        throw new IllegalArgumentException(\n                                \"Mongo client named '%s' not found\".formatted(forceMongoClientName));\n                    }\n                    clientNameSelected = forceMongoClientName;\n                } else if (MongoConfig.isDefaultClient(clientName)) {\n                    mongoClientConfig = mongodbRuntimeConfig.getValue().clients().get(clientName);\n                    clientNameSelected = clientName;\n                } else {\n                    mongoClientConfig = getRequiredConfig(mongodbRuntimeConfig.getValue().clients(),\n                            \"Mongo client named '%s' not found\");\n                    clientNameSelected = clientName;\n                }\n                return new LiquibaseMongodbFactory(\n                        liquibaseMongodbClientConfig,\n                        buildTimeClientConfig,\n                        mongoClientConfig,\n                        clientNameSelected);\n            }\n        };","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/liquibase/liquibase-mongodb/runtime/src/main/java/io/quarkus/liquibase/mongodb/runtime/LiquibaseMongodbRecorder.java#L44-L80","documentation":"The Liquibase MongoDB extension needs to obtain the MongoClient configuration for the client it should run migrations against. When quarkus.liquibase-mongodb.mongo-client-name (or the client name derived from the config group) does not match any key in quarkus.mongodb.clients.*, the lookup returns null and this IllegalArgumentException is thrown at startup before Liquibase runs.","triggerScenarios":"quarkus.liquibase-mongodb.mongo-client-name is set to a name that has no matching entry under quarkus.mongodb.<name>.* (e.g. pointing at 'default' while only a named client exists, or a typo).","commonSituations":"Renaming a MongoDB client config without updating liquibase-mongodb's mongo-client-name; copy-pasting config from an app with a named client; splitting one Mongo config into named clients during a refactor; profile-specific config that only defines the client in one profile.","solutions":["Add a matching client config: define quarkus.mongodb.<client-name>.connection-string (etc.) for the name referenced by quarkus.liquibase-mongodb.mongo-client-name","Fix the typo / remove quarkus.liquibase-mongodb.mongo-client-name if the default client (quarkus.mongodb.*) is intended","Verify effective config per profile (mvn quarkus:dev and check config dump) since the client may only exist in one profile"],"exampleFix":"// before\nquarkus.liquibase-mongodb.mongo-client-name=orders-db\n# no quarkus.mongodb.orders-db.* defined\n// after\nquarkus.liquibase-mongodb.mongo-client-name=orders-db\nquarkus.mongodb.orders-db.connection-string=mongodb://localhost:27017\nquarkus.mongodb.orders-db.database=orders","handlingStrategy":"validation","validationCode":"String name = config.liquibaseMongoClientName();\nMap<String, MongoClientConfig> clients = mongodbConfig.clients();\nif (name != null && !clients.containsKey(name)) {\n    throw new IllegalArgumentException(\n        \"quarkus.liquibase-mongodb.mongo-client-name '%s' has no matching quarkus.mongodb.%s.* config\"\n            .formatted(name, name));\n}","typeGuard":null,"tryCatchPattern":"try {\n    liquibaseMongodbConfig.mongoClientName().ifPresent(n ->\n        Objects.requireNonNull(mongoClients.get(n), \"Mongo client '%s' not configured\".formatted(n)));\n} catch (IllegalArgumentException e) {\n    log.errorf(\"Liquibase Mongo client misconfiguration: %s\", e.getMessage());\n    throw e; // fail fast at startup\n}","preventionTips":["Keep liquibase-mongodb's mongo-client-name and the quarkus.mongodb.<name>.* keys in the same config file/profile","Grep config for mongo-client-name and confirm each name exists under quarkus.mongodb when renaming clients","Rely on the default client (omit mongo-client-name) when only one Mongo client exists","Add a startup smoke test that boots the app in each profile used in CI"],"tags":["quarkus","mongodb","liquibase","configuration"],"backgroundTag":"named-dependency-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}