{"record":{"id":"730d8e9d3d83b7e2","repo":"apache/dubbo","slug":"duplicate-configs-found-for-configname-only-one","errorCode":null,"errorMessage":"Duplicate Configs found for <configName>, only one unique <configName> is allowed for one application. previous: <oldOne>, later: <config>. According to config mode [<configMode>], please remove redundant configs and keep only one.","messagePattern":"Duplicate Configs found for <configName>, only one unique <configName> is allowed for one application\\. previous: <oldOne>, later: <config>\\. According to config mode \\[<configMode>\\], please remove redundant configs and keep only one\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/config/context/AbstractConfigManager.java","lineNumber":453,"sourceCode":"        list = configsMap.values().stream()\n                .filter(c -> AbstractConfigManager.isDefaultConfig(c) == null)\n                .collect(Collectors.toList());\n        return list;\n\n        // exclude isDefault() == false\n    }\n\n    protected <C extends AbstractConfig> Optional<C> checkUniqueConfig(Map<String, C> configsMap, C config) {\n        if (configsMap.size() > 0 && isUniqueConfig(config)) {\n            C oldOne = configsMap.values().iterator().next();\n            String configName = oldOne.getClass().getSimpleName();\n            String msgPrefix = \"Duplicate Configs found for \" + configName + \", only one unique \" + configName\n                    + \" is allowed for one application. previous: \" + oldOne + \", later: \" + config\n                    + \". According to config mode [\" + configMode + \"], \";\n            switch (configMode) {\n                case STRICT: {\n                    if (!isEquals(oldOne, config)) {\n                        throw new IllegalStateException(\n                                msgPrefix + \"please remove redundant configs and keep only one.\");\n                    }\n                    break;\n                }\n                case IGNORE: {\n                    // ignore later config\n                    if (logger.isWarnEnabled() && duplicatedConfigs.add(config)) {\n                        logger.warn(\n                                COMMON_UNEXPECTED_EXCEPTION,\n                                \"\",\n                                \"\",\n                                msgPrefix + \"keep previous config and ignore later config\");\n                    }\n                    return Optional.of(oldOne);\n                }\n                case OVERRIDE: {\n                    // clear previous config, add new config\n                    configsMap.clear();","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/config/context/AbstractConfigManager.java#L435-L471","documentation":"Thrown by AbstractConfigManager.checkUniqueConfig() in STRICT config mode when a second config of a unique type (ApplicationConfig, ModuleConfig, etc.) is added and its values differ from the existing one. The message reports both previous and later config plus the active config mode, telling the user the conflict is fatal under STRICT. In OVERRIDE/IGNORE modes the same situation is handled non-fatally.","triggerScenarios":"Adding a second ApplicationConfig (or other unique type) with different attribute values while dubbo.config.mode=STRICT. Programmatically calling addConfig twice for a unique type with non-equal contents.","commonSituations":"Spring Boot auto-configuration creating an ApplicationConfig and application code also defining one with different attributes. Multi-module setups where each module declares its own application config. Default STRICT mode surfacing conflicts that OVERRIDE mode would silently resolve.","solutions":["Remove one of the conflicting configs and keep a single source of truth.","Make the two configs equal if both are legitimately needed (then STRICT allows the duplicate).","Set dubbo.config.mode=OVERRIDE to let the later config win, or IGNORE to keep the first (only if intended)."],"exampleFix":"# before (STRICT mode, conflicting app configs)\ndubbo.application.name=appA\ndubbo.application.name=appB\n# after (single source)\ndubbo.application.name=appA\n# or relax mode\ndubbo.config.mode=OVERRIDE","handlingStrategy":"validation","validationCode":"// Detect unique-config duplication before it throws\nAbstractConfig existing = configManager.getSingleConfig(\"application\");\nif (existing != null && !isEquals(existing, newAppConfig)) {\n    throw new IllegalStateException(\"Conflicting application configs under STRICT mode\");\n}\nconfigManager.addConfig(newAppConfig);","typeGuard":"static boolean wouldConflictUnique(ConfigManager cm, AbstractConfig newCfg) {\n    AbstractConfig existing = cm.getSingleConfig(newCfg.getTagName());\n    return existing != null && !existing.equals(newCfg);\n}","tryCatchPattern":"try {\n    configManager.addConfig(appConfig);\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"Duplicate Configs found\")) {\n        // remove the redundant config or set dubbo.config.mode=OVERRIDE\n    } else throw e;\n}","preventionTips":["Keep a single source of truth for unique configs (application, module, monitor).","Disable Spring Boot auto-config if you define the bean yourself.","Use OVERRIDE mode only when intentional override is desired."],"tags":["config","duplicate","unique-config","config-mode","strict"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}