{"record":{"id":"be9583ac9fd13cd6","repo":"apache/dubbo","slug":"found-multiple-configtype-s-with-unique-service-n","errorCode":null,"errorMessage":"Found multiple <configType>s with unique service name [<uniqueServiceName>], previous: <prevConfig>, later: <config>. There can only be one instance of <configType> with the same triple (group, interface, version). If multiple instances are required for the same interface, please use a different group or version.","messagePattern":"Found multiple <configType>s with unique service name \\[<uniqueServiceName>\\], previous: <prevConfig>, later: <config>\\. There can only be one instance of <configType> with the same triple \\(group, interface, version\\)\\. If multiple instances are required for the same interface, please use a different group or version\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/config/context/ModuleConfigManager.java","lineNumber":267,"sourceCode":"            if (prevConfig.equals(config)) {\n                // Is there any problem with ignoring duplicate and equivalent but different ReferenceConfig instances?\n                if (logger.isWarnEnabled() && duplicatedConfigs.add(config)) {\n                    logger.warn(COMMON_UNEXPECTED_EXCEPTION, \"\", \"\", \"Ignore duplicated and equal config: \" + config);\n                }\n                return prevConfig;\n            }\n\n            String configType = config.getClass().getSimpleName();\n            String msg = \"Found multiple \" + configType + \"s with unique service name [\" + uniqueServiceName\n                    + \"], previous: \" + prevConfig + \", later: \" + config + \". \" + \"There can only be one instance of \"\n                    + configType + \" with the same triple (group, interface, version). \"\n                    + \"If multiple instances are required for the same interface, please use a different group or version.\";\n\n            if (logger.isWarnEnabled() && duplicatedConfigs.add(config)) {\n                logger.warn(COMMON_UNEXPECTED_EXCEPTION, \"\", \"\", msg);\n            }\n            if (!this.ignoreDuplicatedInterface) {\n                throw new IllegalStateException(msg);\n            }\n        }\n        return prevConfig;\n    }\n\n    private void removeInterfaceConfig(AbstractInterfaceConfig config) {\n        String uniqueServiceName;\n        Map<String, AbstractInterfaceConfig> configCache;\n        if (config instanceof ReferenceConfigBase) {\n            return;\n        } else if (config instanceof ServiceConfigBase) {\n            ServiceConfigBase serviceConfig = (ServiceConfigBase) config;\n            uniqueServiceName = serviceConfig.getUniqueServiceName();\n            configCache = serviceConfigCache;\n        } else {\n            throw new IllegalArgumentException(\n                    \"Illegal type of parameter 'config' : \" + config.getClass().getName());\n        }","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/config/context/ModuleConfigManager.java#L249-L285","documentation":"Thrown by ModuleConfigManager.findDuplicatedInterfaceConfig() (when ignoreDuplicatedInterface is false) when a second ServiceConfigBase with the same unique service name (group+interface+version triple) is registered. The unique service name must be unique per service identity; a duplicate triple is ambiguous for registration and routing. When ignoreDuplicatedInterface is true it only warns instead.","triggerScenarios":"Registering two ServiceConfig with the same interface, group, and version. Programmatic double-registration of the same service identity. Two Spring beans exporting the same interface without differing group/version.","commonSituations":"Accidentally defining the same <dubbo:service interface=...> in two contexts. Merging modules that both export the same interface. Forgetting to set group/version to disambiguate multi-implementation exports.","solutions":["Differentiate the services by group or version so the (group, interface, version) triple is unique.","Remove the duplicate service export.","Set ignoreDuplicatedInterface=true (dubbo.config.ignore-duplicated-interface) only if the duplicate is intentional and equivalent."],"exampleFix":"<!-- before: same triple -->\n<dubbo:service interface=\"com.x.Foo\" group=\"g\" version=\"1.0\"/>\n<dubbo:service interface=\"com.x.Foo\" group=\"g\" version=\"1.0\"/>\n<!-- after: differ by version -->\n<dubbo:service interface=\"com.x.Foo\" group=\"g\" version=\"1.0\"/>\n<dubbo:service interface=\"com.x.Foo\" group=\"g\" version=\"2.0\"/>","handlingStrategy":"validation","validationCode":"// Ensure (group, interface, version) uniqueness before registering\nString key = group + \"/\" + iface.getName() + \":\" + version;\nif (registeredServiceKeys.contains(key)) {\n    throw new IllegalStateException(\"Duplicate service identity: \" + key + \"; change group or version\");\n}\nregisteredServiceKeys.add(key);\nserviceConfig.export();","typeGuard":"static boolean isUniqueServiceTriple(java.util.Set<String> seen, String group, String iface, String version) {\n    return seen.add(group + \"/\" + iface + \":\" + version);\n}","tryCatchPattern":"try {\n    serviceConfig.export();\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"Found multiple\") && e.getMessage().contains(\"unique service name\")) {\n        serviceConfig.setVersion(serviceConfig.getVersion() + \"-alt\"); // disambiguate\n        serviceConfig.export();\n    } else throw e;\n}","preventionTips":["Disambiguate multi-implementation exports via group/version.","Maintain a registry of exported service keys and assert uniqueness in tests.","Avoid defining the same <dubbo:service> across multiple Spring contexts."],"tags":["config","service","duplicate","unique-service-name","module"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}