apache/dubbo · error · IllegalStateException

load config failed, id: <id>, type:<cls.getSimpleName()>

Error message

load config failed, id: <id>, type:<cls.getSimpleName()>

What it means

Thrown by AbstractConfigManager during bulk config loading when config.refresh() or addConfig() fails for a specific id after the config was successfully instantiated. refresh() re-reads properties into the config object; a failure (type mismatch, invalid value) during refresh surfaces wrapped with the id and config type. Unlike the create failure, the instance existed but its property population failed.

Source

Thrown at dubbo-common/src/main/java/org/apache/dubbo/config/context/AbstractConfigManager.java:549

                try {
                    // add default name config (same as id), e.g. dubbo.protocols.rest.port=1234
                    key = DUBBO + "." + AbstractConfig.getPluralTagName(cls) + "." + id + ".name";
                    if (properties.getProperty(key) == null) {
                        properties.setProperty(key, id);
                        addDefaultNameConfig = true;
                    }

                    config.refresh();
                    this.addConfig(config);
                    tmpConfigs.add(config);
                } catch (Exception e) {
                    logger.error(
                            COMMON_PROPERTY_TYPE_MISMATCH,
                            "",
                            "",
                            "load config failed, id: " + id + ", type:" + cls.getSimpleName(),
                            e);
                    throw new IllegalStateException("load config failed, id: " + id + ", type:" + cls.getSimpleName());
                } finally {
                    if (addDefaultNameConfig && key != null) {
                        properties.remove(key);
                    }
                }
            }
        });

        // If none config of the type, try load single config
        if (this.getConfigs(cls).isEmpty()) {
            // load single config
            List<Map<String, String>> configurationMaps = environment.getConfigurationMaps();
            if (ConfigurationUtils.hasSubProperties(configurationMaps, AbstractConfig.getTypePrefix(cls))) {
                T config;
                try {
                    config = createConfig(cls, scopeModel);
                    config.refresh();
                } catch (Exception e) {

View on GitHub (pinned to 3a3043227f)

Solutions

  1. Check the logged preceding error (COMMON_PROPERTY_TYPE_MISMATCH) for the offending property and value.
  2. Correct the property value type to match the config field (e.g. integer port, valid enum).
  3. Remove unknown/typo'd property keys under that config id's prefix.

Example fix

# before
dubbo.protocols.rest.port=abc
# after
dubbo.protocols.rest.port=8080
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-validate property types before refresh
Properties props = environment.getPropertiesConfiguration();
String portKey = "dubbo.protocols.rest.port";
if (props.getProperty(portKey) != null) {
    try { Integer.parseInt(props.getProperty(portKey)); }
    catch (NumberFormatException e) { throw new IllegalArgumentException(portKey + " must be integer"); }
}
configManager.loadConfigs(ProtocolConfig.class);

Type guard

static boolean isIntegerProperty(Properties p, String key) {
    String v = p.getProperty(key);
    if (v == null) return true;
    try { Integer.parseInt(v); return true; } catch (NumberFormatException e) { return false; }
}

Try / catch

try {
    configManager.loadConfigs(ProtocolConfig.class);
} catch (IllegalStateException e) {
    if (e.getMessage().startsWith("load config failed")) {
        // check the COMMON_PROPERTY_TYPE_MISMATCH log line above for the offending property
    } else throw e;
}

Prevention

When it happens

Trigger: A property value under dubbo.<plural>.<id>.* that cannot be converted to the config field type (e.g. a non-numeric port, invalid enum). refresh() throwing during reflective property binding.

Common situations: dubbo.protocols.rest.port=abc (non-integer). A misspelled enum-valued property. Properties referencing values incompatible with the field type after a Dubbo upgrade changed a field type.

Related errors


AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14). Data as JSON: /api/errors/ceb42a1a388b0e8c. Report an issue: GitHub.