apache/dubbo · error · IllegalStateException
Found multiple <configType>s with unique service name [<uniq
Error message
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.
What it means
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.
Source
Thrown at dubbo-common/src/main/java/org/apache/dubbo/config/context/ModuleConfigManager.java:267
if (prevConfig.equals(config)) {
// Is there any problem with ignoring duplicate and equivalent but different ReferenceConfig instances?
if (logger.isWarnEnabled() && duplicatedConfigs.add(config)) {
logger.warn(COMMON_UNEXPECTED_EXCEPTION, "", "", "Ignore duplicated and equal config: " + config);
}
return prevConfig;
}
String configType = config.getClass().getSimpleName();
String msg = "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.";
if (logger.isWarnEnabled() && duplicatedConfigs.add(config)) {
logger.warn(COMMON_UNEXPECTED_EXCEPTION, "", "", msg);
}
if (!this.ignoreDuplicatedInterface) {
throw new IllegalStateException(msg);
}
}
return prevConfig;
}
private void removeInterfaceConfig(AbstractInterfaceConfig config) {
String uniqueServiceName;
Map<String, AbstractInterfaceConfig> configCache;
if (config instanceof ReferenceConfigBase) {
return;
} else if (config instanceof ServiceConfigBase) {
ServiceConfigBase serviceConfig = (ServiceConfigBase) config;
uniqueServiceName = serviceConfig.getUniqueServiceName();
configCache = serviceConfigCache;
} else {
throw new IllegalArgumentException(
"Illegal type of parameter 'config' : " + config.getClass().getName());
}View on GitHub (pinned to 3a3043227f)
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.
Example fix
<!-- before: same triple --> <dubbo:service interface="com.x.Foo" group="g" version="1.0"/> <dubbo:service interface="com.x.Foo" group="g" version="1.0"/> <!-- after: differ by version --> <dubbo:service interface="com.x.Foo" group="g" version="1.0"/> <dubbo:service interface="com.x.Foo" group="g" version="2.0"/>
Defensive patterns
Strategy: validation
Validate before calling
// Ensure (group, interface, version) uniqueness before registering
String key = group + "/" + iface.getName() + ":" + version;
if (registeredServiceKeys.contains(key)) {
throw new IllegalStateException("Duplicate service identity: " + key + "; change group or version");
}
registeredServiceKeys.add(key);
serviceConfig.export(); Type guard
static boolean isUniqueServiceTriple(java.util.Set<String> seen, String group, String iface, String version) {
return seen.add(group + "/" + iface + ":" + version);
} Try / catch
try {
serviceConfig.export();
} catch (IllegalStateException e) {
if (e.getMessage().contains("Found multiple") && e.getMessage().contains("unique service name")) {
serviceConfig.setVersion(serviceConfig.getVersion() + "-alt"); // disambiguate
serviceConfig.export();
} else throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Expected single instance of <configType>, but found <size> i
- Found more than one config by name: <name>, instances: <list
- Duplicate Configs found for <configName>, only one unique <c
- Illegal type of parameter 'config' : <config.getClass().getN
- Invalid configurator rule, please specify at least one param
AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14).
Data as JSON: /api/errors/be9583ac9fd13cd6.
Report an issue: GitHub.