apache/dubbo · error · IllegalStateException
create default config instance failed, type:<cls.getSimpleNa
Error message
create default config instance failed, type:<cls.getSimpleName()>
What it means
Thrown by AbstractConfigManager when loading a single (default) config of a type from sub-properties fails during createConfig + refresh. This path runs only when no id-based configs of the type were found but sub-properties exist under the type prefix (e.g. dubbo.application.* without an id). A construction or refresh failure here is wrapped with the config type name.
Source
Thrown at dubbo-common/src/main/java/org/apache/dubbo/config/context/AbstractConfigManager.java:568
} 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) {
throw new IllegalStateException(
"create default config instance failed, type:" + cls.getSimpleName(), e);
}
this.addConfig(config);
tmpConfigs.add(config);
}
}
return tmpConfigs;
}
private <T extends AbstractConfig> T createConfig(Class<T> cls, ScopeModel scopeModel)
throws ReflectiveOperationException {
T config = cls.getDeclaredConstructor().newInstance();
config.setScopeModel(scopeModel);
return config;
}
View on GitHub (pinned to 3a3043227f)
Solutions
- Review the sub-properties under the type prefix for invalid/typo values and correct them.
- Check the underlying exception cause via debug logging.
- Ensure the config type's constructor and refresh logic are robust to the supplied properties.
Example fix
# before dubbo.application.qos-enable=maybe # after dubbo.application.qos-enable=true
Defensive patterns
Strategy: try-catch
Validate before calling
// Validate single-config sub-properties are well-typed before load
List<Map<String,String>> maps = environment.getConfigurationMaps();
if (ConfigurationUtils.hasSubProperties(maps, AbstractConfig.getTypePrefix(ApplicationConfig.class))) {
// verify known fields are typed correctly, e.g. qos-enable is boolean
}
configManager.loadConfigs(ApplicationConfig.class); Type guard
static boolean hasSingleConfigPrefix(Environment env, Class<? extends AbstractConfig> cls) {
return ConfigurationUtils.hasSubProperties(env.getConfigurationMaps(), AbstractConfig.getTypePrefix(cls));
} Try / catch
try {
configManager.loadConfigs(ApplicationConfig.class);
} catch (IllegalStateException e) {
if (e.getMessage().startsWith("create default config instance failed")) {
// inspect wrapped cause and correct sub-properties
} else throw e;
} Prevention
- Audit sub-properties under each config prefix for type correctness.
- Enable DEBUG logging on AbstractConfigManager during config load.
- Add integration tests that load configs from realistic properties.
When it happens
Trigger: Sub-properties present for a config type prefix but the reflective construction or property refresh throws (invalid value, constructor error). Occurs in the fallback single-config loading branch.
Common situations: dubbo.application.name set along with an invalid sibling property (e.g. dubbo.application.qos-enable=maybe). A constructor regression in a custom config type used in single-config form.
Related errors
- load config failed, id: <id>, type:<cls.getSimpleName()>
- Illegal 'dubbo.config.mode' config value [<configModeStr>],
- create config instance failed, id: <id>, type:<cls.getSimple
- Add default config failed: <configType.getSimpleName()>
- Invalid configurator rule, please specify at least one param
AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14).
Data as JSON: /api/errors/c8f4402033ce8008.
Report an issue: GitHub.