apache/pulsar · error · RuntimeException

Failed to compute configuration overrides

Error message

Failed to compute configuration overrides

What it means

PulsarConfigurationLoader.runtimeConfigurationOverrides builds a map of configuration overrides by reflectively reading fields of a PulsarConfiguration object and merging properties. Any failure while reflecting over the config fields (e.g. an incompatible/illegal field access during introspection) is wrapped in this RuntimeException. It signals the broker configuration could not be transformed into CLI-style overrides, so startup/tooling cannot proceed with a coherent config view.

Source

Thrown at pulsar-broker-common/src/main/java/org/apache/pulsar/common/configuration/PulsarConfigurationLoader.java:316

                if (field.getDeclaredAnnotation(FieldContext.class) == null) {
                    continue;
                }
                field.setAccessible(true);
                Object current = field.get(conf);
                Object def = field.get(defaults);
                if (!Objects.equals(current, def)) {
                    overrides.put(field.getName(), current);
                }
            }
            Properties props = conf.getProperties();
            if (props != null) {
                for (String key : props.stringPropertyNames()) {
                    overrides.putIfAbsent(key, props.getProperty(key));
                }
            }
            return overrides;
        } catch (ReflectiveOperationException e) {
            throw new RuntimeException("Failed to compute configuration overrides", e);
        }
    }
}

View on GitHub (pinned to 820761864e)

Solutions

  1. Check the 'Caused by' of the RuntimeException to see which reflective operation failed (field name / access error) and fix the configuration class or call site.
  2. Align the Pulsar broker-common jar versions: ensure no mixed/shaded jars where the config class fields no longer match what the loader expects.
  3. If running under JPMS or a security manager, open the configuration package for reflective access (--add-opens) or grant the needed ReflectPermission.
  4. Validate the configuration file loads correctly (config-object fields are populated) before invoking override computation.

Example fix

// before: calling with a custom config class in an unnamed module under JPMS
PulsarConfiguration cfg = loadConfig();
Map<String, Object> overrides = PulsarConfigurationLoader.runtimeConfigurationOverrides(cfg);
// after: open reflective access or revert to stock config class
java --add-opens org.apache.pulsar.broker/org.apache.pulsar.common.configuration=ALL-UNNAMED ...
// or use the stock PulsarConfiguration implementation instead of a renamed subclass
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check: ensure reflective access is possible
try {
    Class<?> cfgClass = config.getClass();
    for (java.lang.reflect.Field f : cfgClass.getDeclaredFields()) {
        f.setAccessible(true);
    }
} catch (Throwable t) {
    // fail fast with a clear message before calling runtimeConfigurationOverrides
}

Try / catch

try {
    overrides = PulsarConfigurationLoader.runtimeConfigurationOverrides(cfg);
} catch (RuntimeException e) {
    Throwable cause = e.getCause(); // ReflectiveOperationException detail
    log.error("Config override computation failed: {}", cause.getMessage(), e);
    throw new IllegalStateException("Invalid configuration setup", e);
}

Prevention

When it happens

Trigger: Calling runtimeConfigurationOverrides(PulsarConfiguration) when reflection over the configuration object fails: field lookup throws NoSuchFieldException, or an inaccessible field triggers IllegalAccessException during the props/overrides merge loop.

Common situations: Running broker tooling (e.g. initialization or standalone startup) against a custom or repackaged configuration class whose fields changed name/type between versions; security managers or module encapsulation (JPMS strong encapsulation) blocking reflective access; shaded/mismatched jars mixing Pulsar versions.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/e95b58bcde481f43. Report an issue: GitHub.