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
- Check the logged preceding error (COMMON_PROPERTY_TYPE_MISMATCH) for the offending property and value.
- Correct the property value type to match the config field (e.g. integer port, valid enum).
- 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
- Type-check numeric/enum properties in config sanity tests.
- Watch the preceding COMMON_PROPERTY_TYPE_MISMATCH log for the offending key.
- Keep a schema of expected property types for each config.
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
- create default config instance failed, type:<cls.getSimpleNa
- '${key}' doesn't map to a Integer object
- Try to get '${key}' failed, maybe because this key doesn't m
- Illegal 'dubbo.config.mode' config value [<configModeStr>],
- create config instance failed, id: <id>, type:<cls.getSimple
AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14).
Data as JSON: /api/errors/ceb42a1a388b0e8c.
Report an issue: GitHub.