{"record":{"id":"c8f4402033ce8008","repo":"apache/dubbo","slug":"create-default-config-instance-failed-type-cls-g","errorCode":null,"errorMessage":"create default config instance failed, type:<cls.getSimpleName()>","messagePattern":"create default config instance failed, type:<cls\\.getSimpleName\\(\\)>","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/config/context/AbstractConfigManager.java","lineNumber":568,"sourceCode":"                } finally {\n                    if (addDefaultNameConfig && key != null) {\n                        properties.remove(key);\n                    }\n                }\n            }\n        });\n\n        // If none config of the type, try load single config\n        if (this.getConfigs(cls).isEmpty()) {\n            // load single config\n            List<Map<String, String>> configurationMaps = environment.getConfigurationMaps();\n            if (ConfigurationUtils.hasSubProperties(configurationMaps, AbstractConfig.getTypePrefix(cls))) {\n                T config;\n                try {\n                    config = createConfig(cls, scopeModel);\n                    config.refresh();\n                } catch (Exception e) {\n                    throw new IllegalStateException(\n                            \"create default config instance failed, type:\" + cls.getSimpleName(), e);\n                }\n\n                this.addConfig(config);\n                tmpConfigs.add(config);\n            }\n        }\n\n        return tmpConfigs;\n    }\n\n    private <T extends AbstractConfig> T createConfig(Class<T> cls, ScopeModel scopeModel)\n            throws ReflectiveOperationException {\n        T config = cls.getDeclaredConstructor().newInstance();\n        config.setScopeModel(scopeModel);\n        return config;\n    }\n","sourceCodeStart":550,"sourceCodeEnd":586,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/config/context/AbstractConfigManager.java#L550-L586","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\ndubbo.application.qos-enable=maybe\n# after\ndubbo.application.qos-enable=true","handlingStrategy":"try-catch","validationCode":"// Validate single-config sub-properties are well-typed before load\nList<Map<String,String>> maps = environment.getConfigurationMaps();\nif (ConfigurationUtils.hasSubProperties(maps, AbstractConfig.getTypePrefix(ApplicationConfig.class))) {\n    // verify known fields are typed correctly, e.g. qos-enable is boolean\n}\nconfigManager.loadConfigs(ApplicationConfig.class);","typeGuard":"static boolean hasSingleConfigPrefix(Environment env, Class<? extends AbstractConfig> cls) {\n    return ConfigurationUtils.hasSubProperties(env.getConfigurationMaps(), AbstractConfig.getTypePrefix(cls));\n}","tryCatchPattern":"try {\n    configManager.loadConfigs(ApplicationConfig.class);\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"create default config instance failed\")) {\n        // inspect wrapped cause and correct sub-properties\n    } else throw e;\n}","preventionTips":["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."],"tags":["config","properties","default-config","config-loading"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}