{"record":{"id":"59d5a11902870e64","repo":"quarkusio/quarkus","slug":"failed-to-initialize-application-configuration","errorCode":null,"errorMessage":"Failed to initialize application configuration","messagePattern":"Failed to initialize application configuration","errorType":"exception","errorClass":"CodeGenException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/CodeGenerator.java","lineNumber":356,"sourceCode":"                }\n            }\n\n            // we don't want to load config services from the current module because they haven't been compiled yet\n            final QuarkusClassLoader.Builder configClBuilder = QuarkusClassLoader.builder(\"CodeGenerator Config ClassLoader\",\n                    deploymentClassLoader, false);\n            if (!allowedConfigServices.isEmpty()) {\n                configClBuilder.addNormalPriorityElement(new MemoryClassPathElement(allowedConfigServices, true));\n            }\n            if (!bannedConfigServices.isEmpty()) {\n                configClBuilder.addBannedElement(new MemoryClassPathElement(bannedConfigServices, true));\n            }\n            deploymentClassLoader = configClBuilder.build();\n            Thread.currentThread().setContextClassLoader(deploymentClassLoader);\n        }\n        try {\n            return function.apply(new BuildTimeConfigurationReader(deploymentClassLoader));\n        } catch (Exception e) {\n            throw new CodeGenException(\"Failed to initialize application configuration\", e);\n        } finally {\n            if (!unavailableConfigServices.isEmpty()) {\n                Thread.currentThread().setContextClassLoader(originalClassLoader);\n                deploymentClassLoader.close();\n            }\n        }\n    }\n\n    private static Map<String, List<String>> getUnavailableConfigServices(ResolvedDependency dep, ClassLoader classLoader)\n            throws CodeGenException {\n        try (OpenPathTree openTree = dep.getContentTree().open()) {\n            var unavailableServices = new HashMap<String, List<String>>();\n            openTree.apply(META_INF_SERVICES, visit -> {\n                if (visit == null) {\n                    // the application module does not include META-INF/services entry. Return `null` here, to let\n                    // MultiRootPathTree.apply() look into all roots.\n                    return null;\n                }","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/CodeGenerator.java#L338-L374","documentation":"CodeGenException thrown by readConfig when the supplied function — most commonly new BuildTimeConfigurationReader(deploymentClassLoader) or configReader.initConfiguration(...) — fails with any Exception. It means Quarkus could not initialize the application's build-time configuration for the code-generation phase. This is the wrapper for essentially all config-mapping/property errors during codegen.","triggerScenarios":"readConfig invokes function.apply(new BuildTimeConfigurationReader(deploymentClassLoader)); a failure loading/validating @ConfigMapping classes, an invalid build-time property value or type, a missing required build-time property, or an exception while a ConfigSourceFactory runs all surfaces as this message.","commonSituations":"Typo or wrong type in a quarkus.* build-time property in application.properties; environment variable values that don't parse (e.g. quarkus.log.level=banana); an extension upgrade changed/removed config keys; custom ConfigSource throwing during init; classloading problems from a broken dependency.","solutions":["Read the full 'Caused by' chain — it names the invalid property, missing mapping, or failing source, then fix application.properties or env vars","Validate build-time property values and types (run quarkus:dev; SmallRye config reports exact property errors)","After a Quarkus upgrade, check the migration guide for renamed/removed quarkus.* keys (build complains about unknown keys)","Temporarily remove custom ConfigSource/ConfigSourceFactory implementations to isolate the failure"],"exampleFix":"// before (application.properties)\nquarkus.package.type=war\n// after: valid enum value for the installed Quarkus version\nquarkus.package.type=uber-jar","handlingStrategy":"try-catch","validationCode":"// Smoke-test build-time config early\ntry (Config cfg = ConfigProvider.getConfig()) {\n    for (String name : cfg.getPropertyNames()) {\n        if (name.startsWith(\"quarkus.\")) cfg.getConfigValue(name); // triggers parsing/validation\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    return function.apply(new BuildTimeConfigurationReader(deploymentClassLoader));\n} catch (CodeGenException e) {\n    Throwable r = e;\n    while (r.getCause() != null) r = r.getCause();\n    throw new IllegalArgumentException(\"Invalid build-time configuration: \" + r.getMessage(), e);\n}","preventionTips":["Read the deepest 'Caused by' — it names the exact invalid property","After Quarkus upgrades, review the migration guide for removed/renamed config keys","Use quarkus:dev (fail-fast property validation) before CI builds","Validate env vars that map to quarkus.* properties (types, enums, levels)"],"tags":["quarkus","build-time-config","configuration","config-mapping"],"backgroundTag":"build-time-config-init-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}