{"record":{"id":"8f8b2773ef8c6380","repo":"quarkusio/quarkus","slug":"quartz-datasource-resolution-can-be-either-deferre","errorCode":null,"errorMessage":"Quartz datasource resolution can be either deferred to runtime or specified at build time but not both. Related properties are quarkus.quartz.defer-datasource-check=%s and quarkus.quartz.datasource=%s","messagePattern":"Quartz datasource resolution can be either deferred to runtime or specified at build time but not both\\. Related properties are quarkus\\.quartz\\.defer-datasource-check=(.+?) and quarkus\\.quartz\\.datasource=(.+?)","errorType":"exception","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/QuartzProcessor.java","lineNumber":179,"sourceCode":"                    }\n                }\n                if (!implementsKnownDelegate) {\n                    String message = String.format(\n                            \"Custom JDBC delegate implementation with name '%s' needs to be a subclass of one of the existing Quarkus delegates such as io.quarkus.quartz.runtime.jdbc.QuarkusPostgreSQLDelegate.\",\n                            driverDelegate.get());\n                    throw new ConfigurationException(message);\n                }\n            }\n            // A custom delegate implementation, we don't need to check datasources\n            return new QuartzJDBCDriverDialectBuildItem(driverDelegate, null);\n        } else {\n            if (config.deferDatasourceCheck()) {\n                // if defer is set to true and there is a DS name, throw an exception\n                if (config.dataSourceName().isPresent()) {\n                    String message = String.format(\n                            \"Quartz datasource resolution can be either deferred to runtime or specified at build time but not both. Related properties are quarkus.quartz.defer-datasource-check=%s and quarkus.quartz.datasource=%s\",\n                            config.deferDatasourceCheck(), config.dataSourceName());\n                    throw new ConfigurationException(message);\n                }\n                // Defer driver resolution to runtime\n                List<JDBCDataSource> dataSources = new ArrayList<>();\n                for (JdbcDataSourceBuildItem jdbcDataSourceBuildItem : jdbcDataSourceBuildItems) {\n                    dataSources.add(new JDBCDataSource(jdbcDataSourceBuildItem.getName(), jdbcDataSourceBuildItem.isDefault(),\n                            jdbcDataSourceBuildItem.getDbKind()));\n                }\n                return new QuartzJDBCDriverDialectBuildItem(Optional.empty(), dataSources);\n            } else {\n                // Perform driver resolution at build time\n                Optional<JdbcDataSourceBuildItem> selectedJdbcDataSourceBuildItem = jdbcDataSourceBuildItems.stream()\n                        .filter(i -> config.dataSourceName().isPresent() ? config.dataSourceName().get().equals(i.getName())\n                                : i.isDefault())\n                        .findFirst();\n\n                if (!selectedJdbcDataSourceBuildItem.isPresent()) {\n                    String message = String.format(\n                            \"JDBC Store configured but the '%s' datasource is not configured properly. You can configure your datasource by following the guide available at: https://quarkus.io/guides/datasource\",","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/QuartzProcessor.java#L161-L197","documentation":"The Quartz build-time configuration is contradictory: quarkus.quartz.defer-datasource-check=true (datasource resolved at runtime) is combined with an explicit quarkus.quartz.datasource name (build-time resolution). The driver() build step can only follow one resolution strategy, so it rejects the combination at build time.","triggerScenarios":"application.properties contains both quarkus.quartz.defer-datasource-check=true and quarkus.quartz.datasource=<name> while store-type is a JDBC store; or defer is set via profile/env variable while a datasource name is hardcoded in build-time properties.","commonSituations":"Enabling defer-datasource-check to support runtime datasources without removing an older quarkus.quartz.datasource entry; copying config snippets from different guides; profiles where one profile sets defer=true and the base config sets a datasource name.","solutions":["Remove quarkus.quartz.datasource=<name> if you want runtime datasource resolution (keep defer-datasource-check=true).","Or set quarkus.quartz.defer-datasource-check=false (or remove it) for build-time resolution against the named datasource.","Check profile-specific config files and environment variables so only one of the two properties is active."],"exampleFix":"// before\nquarkus.quartz.defer-datasource-check=true\nquarkus.quartz.datasource=myds\n\n// after (choose one)\nquarkus.quartz.defer-datasource-check=true\n// or\nquarkus.quartz.datasource=myds","handlingStrategy":"validation","validationCode":"java.util.Properties p = new java.util.Properties();\np.load(new java.io.FileInputStream(\"application.properties\"));\nboolean defer = Boolean.parseBoolean(p.getProperty(\"quarkus.quartz.defer-datasource-check\", \"false\"));\nString ds = p.getProperty(\"quarkus.quartz.datasource\");\nif (defer && ds != null) {\n    throw new IllegalStateException(\"Use either quarkus.quartz.defer-datasource-check=true OR quarkus.quartz.datasource, not both\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick one strategy per app: runtime resolution (defer=true) or build-time named datasource - never both.","Audit profile-specific properties files and env vars for hidden overrides.","Add a config linting test to your CI pipeline.","Prefer explicit quarkus.quartz.datasource in prod and defer-datasource-check only in dev/test."],"tags":["quarkus","quartz","configuration","datasource","build-time"],"backgroundTag":"conflicting-configuration-properties","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"}