{"record":{"id":"d907831a31f31ba7","repo":"quarkusio/quarkus","slug":"build-time-property-cannot-be-changed-at-runtime","errorCode":null,"errorMessage":"Build time property cannot be changed at runtime:\n${mismatches}","messagePattern":"Build time property cannot be changed at runtime:\n(.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigRecorder.java","lineNumber":72,"sourceCode":"            }\n        }\n\n        // Enable the BuildTime RunTime Fixed. It should be fine doing these operations, because this is on startup\n        if (builtTimeRunTimeFixedConfigSource.isPresent()) {\n            ConfigSource configSource = builtTimeRunTimeFixedConfigSource.get();\n            if (configSource instanceof DisableableConfigSource) {\n                ((DisableableConfigSource) configSource).enable();\n            }\n        }\n\n        if (!mismatches.isEmpty()) {\n            String msg = \"Build time property cannot be changed at runtime:\\n\" + String.join(\"\\n\", mismatches);\n            // TODO - This should use ConfigConfig, but for some reason, the test fails sometimes with mapping not found when looking ConfigConfig\n            BuildTimeMismatchAtRuntime buildTimeMismatchAtRuntime = config\n                    .getOptionalValue(\"quarkus.config.build-time-mismatch-at-runtime\", BuildTimeMismatchAtRuntime.class)\n                    .orElse(warn);\n            if (fail.equals(buildTimeMismatchAtRuntime)) {\n                throw new IllegalStateException(msg);\n            } else if (warn.equals(buildTimeMismatchAtRuntime)) {\n                log.warn(msg);\n            }\n        }\n    }\n\n    public void handleNativeProfileChange(List<String> buildProfiles) {\n        SmallRyeConfig config = ConfigProvider.getConfig().unwrap(SmallRyeConfig.class);\n        List<String> runtimeProfiles = config.getProfiles();\n\n        if (buildProfiles.size() != runtimeProfiles.size()) {\n            log.warn(\n                    \"The profile '\" + buildProfiles + \"' used to build the native image is different from the runtime profile '\"\n                            + runtimeProfiles + \"'. This may lead to unexpected results.\");\n            return;\n        }\n\n        for (int i = 0; i < buildProfiles.size(); i++) {","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigRecorder.java#L54-L90","documentation":"ConfigRecorder.handleConfigChange() compares build-time configuration captured at image/build time against runtime values. When build-time properties were changed at runtime, it throws IllegalStateException listing the mismatched properties — unless quarkus.config.build-time-mismatch-at-runtime is set to warn or ignore.","triggerScenarios":"Changing a build-time property (one fixed at build, e.g. quarkus.datasource.db-kind, extension build options) in application.properties/env at startup of an already-built application (especially native image or fast-jar), then booting.","commonSituations":"Reusing a native binary with a different config than used at build; CI built with one profile and prod runs with another; a property moved from runtime to build-time scope after a Quarkus upgrade.","solutions":["Rebuild/recompile the application with the new build-time values (e.g. mvn package / native-image rebuild).","Revert the runtime config to match build-time values.","Set quarkus.config.build-time-mismatch-at-runtime=warn (or ignore) at build time if overriding is acceptable — note this property itself is read at runtime from the captured config.","Audit the listed properties: anything in the mismatches list must not be set at runtime."],"exampleFix":"# before (runtime override of build-time prop)\nquarkus.datasource.db-kind=postgresql\n# after\n# remove the property at runtime; set it at build time and rebuild\n./mvnw package -Dquarkus.datasource.db-kind=postgresql","handlingStrategy":"validation","validationCode":"// Compare runtime values against the build-time snapshot before startup\nSet<String> allowedRuntimeOverrides = Set.of(\"quarkus.log.level\");\nfor (String prop : changedProps) {\n    if (!allowedRuntimeOverrides.contains(prop)) {\n        throw new IllegalStateException(\"Build-time property changed at runtime: \" + prop);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    // application startup\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Build time property cannot be changed at runtime\")) {\n        // parse listed properties, align config, or rebuild the app\n        throw new IllegalStateException(\"Rebuild the app with the new build-time config\", e);\n    }\n    throw e;\n}","preventionTips":["Treat build-time properties as immutable after build; set them only at build time","Rebuild (mvn package / native-image) whenever build-time config changes","Set quarkus.config.build-time-mismatch-at-runtime=warn deliberately if overrides are intended","Read the mismatch list in the message — it names exactly which properties to fix"],"tags":["configuration","build-time-config","runtime-mismatch","illegal-state"],"backgroundTag":"build-time-config-changed-at-runtime","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"}