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

  1. Review the sub-properties under the type prefix for invalid/typo values and correct them.
  2. Check the underlying exception cause via debug logging.
  3. 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

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


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