quarkusio/quarkus · critical · IllegalStateException

Build time property cannot be changed at runtime: ${mismatch

Error message

Build time property cannot be changed at runtime:
${mismatches}

What it means

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.

Source

Thrown at core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigRecorder.java:72

            }
        }

        // Enable the BuildTime RunTime Fixed. It should be fine doing these operations, because this is on startup
        if (builtTimeRunTimeFixedConfigSource.isPresent()) {
            ConfigSource configSource = builtTimeRunTimeFixedConfigSource.get();
            if (configSource instanceof DisableableConfigSource) {
                ((DisableableConfigSource) configSource).enable();
            }
        }

        if (!mismatches.isEmpty()) {
            String msg = "Build time property cannot be changed at runtime:\n" + String.join("\n", mismatches);
            // TODO - This should use ConfigConfig, but for some reason, the test fails sometimes with mapping not found when looking ConfigConfig
            BuildTimeMismatchAtRuntime buildTimeMismatchAtRuntime = config
                    .getOptionalValue("quarkus.config.build-time-mismatch-at-runtime", BuildTimeMismatchAtRuntime.class)
                    .orElse(warn);
            if (fail.equals(buildTimeMismatchAtRuntime)) {
                throw new IllegalStateException(msg);
            } else if (warn.equals(buildTimeMismatchAtRuntime)) {
                log.warn(msg);
            }
        }
    }

    public void handleNativeProfileChange(List<String> buildProfiles) {
        SmallRyeConfig config = ConfigProvider.getConfig().unwrap(SmallRyeConfig.class);
        List<String> runtimeProfiles = config.getProfiles();

        if (buildProfiles.size() != runtimeProfiles.size()) {
            log.warn(
                    "The profile '" + buildProfiles + "' used to build the native image is different from the runtime profile '"
                            + runtimeProfiles + "'. This may lead to unexpected results.");
            return;
        }

        for (int i = 0; i < buildProfiles.size(); i++) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Rebuild/recompile the application with the new build-time values (e.g. mvn package / native-image rebuild).
  2. Revert the runtime config to match build-time values.
  3. 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.
  4. Audit the listed properties: anything in the mismatches list must not be set at runtime.

Example fix

# before (runtime override of build-time prop)
quarkus.datasource.db-kind=postgresql
# after
# remove the property at runtime; set it at build time and rebuild
./mvnw package -Dquarkus.datasource.db-kind=postgresql
Defensive patterns

Strategy: validation

Validate before calling

// Compare runtime values against the build-time snapshot before startup
Set<String> allowedRuntimeOverrides = Set.of("quarkus.log.level");
for (String prop : changedProps) {
    if (!allowedRuntimeOverrides.contains(prop)) {
        throw new IllegalStateException("Build-time property changed at runtime: " + prop);
    }
}

Try / catch

try {
    // application startup
} catch (IllegalStateException e) {
    if (e.getMessage().startsWith("Build time property cannot be changed at runtime")) {
        // parse listed properties, align config, or rebuild the app
        throw new IllegalStateException("Rebuild the app with the new build-time config", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/d907831a31f31ba7. Report an issue: GitHub.