apache/dubbo · error · IllegalStateException
Registry not found: <id>
Error message
Registry not found: <id>
What it means
Thrown by AbstractInterfaceConfig.convertRegistryIdsToRegistries() during registry resolution. When a comma-separated `registryIds` value is set, Dubbo splits it and looks up each id in the ConfigManager; if none of the registered RegistryConfig instances match the id, this IllegalStateException is thrown. It indicates a configuration reference to a registry that was never declared or was declared under a different id.
Source
Thrown at dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java:515
private void convertRegistryIdsToRegistries() {
computeValidRegistryIds();
if (StringUtils.isEmpty(registryIds)) {
if (CollectionUtils.isEmpty(registries)) {
List<RegistryConfig> registryConfigs = getConfigManager().getDefaultRegistries();
registryConfigs = new ArrayList<>(registryConfigs);
setRegistries(registryConfigs);
}
} else {
String[] ids = COMMA_SPLIT_PATTERN.split(registryIds);
List<RegistryConfig> tmpRegistries = new ArrayList<>();
Arrays.stream(ids).forEach(id -> {
if (tmpRegistries.stream().noneMatch(reg -> reg.getId().equals(id))) {
Optional<RegistryConfig> globalRegistry = getConfigManager().getRegistry(id);
if (globalRegistry.isPresent()) {
tmpRegistries.add(globalRegistry.get());
} else {
throw new IllegalStateException("Registry not found: " + id);
}
}
});
setRegistries(tmpRegistries);
}
}
protected boolean notHasSelfRegistryProperty() {
return CollectionUtils.isEmpty(registries) && StringUtils.isEmpty(registryIds);
}
protected void completeCompoundConfigs(AbstractInterfaceConfig interfaceConfig) {
if (interfaceConfig != null) {
if (application == null) {
setApplication(interfaceConfig.getApplication());
}
if (module == null) {
setModule(interfaceConfig.getModule());View on GitHub (pinned to 3a3043227f)
Solutions
- Check that every id in registryIds/registry has a matching RegistryConfig registered (e.g. a <dubbo:registry id="..."> bean or dubbo.registry.<id>.address property).
- Correct typos in registry id references.
- Register the missing registry config before the service/reference that uses it.
- If using programmatic config, ensure getConfigManager().addConfig(registryConfig) is called with the matching id.
Example fix
// before <dubbo:registry id="mainRegistry" address="zookeeper://..."/> <dubbo:service interface="..." registry="mainRegstry"/> <!-- typo --> // after <dubbo:registry id="mainRegistry" address="zookeeper://..."/> <dubbo:service interface="..." registry="mainRegistry"/>
Defensive patterns
Strategy: validation
Validate before calling
// Validate every registry id is registered before referencing
import org.apache.dubbo.config.context.ConfigManager;
ConfigManager cm = applicationModel.getApplicationConfigManager();
for (String id : registryIds.split(",")) {
id = id.trim();
if (id.isEmpty()) continue;
if (!cm.getRegistry(id).isPresent()) {
throw new IllegalStateException("Missing RegistryConfig for id: " + id);
}
}
serviceConfig.setRegistryIds(registryIds); Type guard
static boolean allRegistriesRegistered(ConfigManager cm, String registryIdsCsv) {
if (registryIdsCsv == null || registryIdsCsv.isEmpty()) return true;
for (String id : registryIdsCsv.split(",")) {
if (!cm.getRegistry(id.trim()).isPresent()) return false;
}
return true;
} Try / catch
try {
serviceConfig.setRegistryIds(ids);
serviceConfig.export();
} catch (IllegalStateException e) {
if (e.getMessage().startsWith("Registry not found:")) {
String missingId = e.getMessage().substring("Registry not found:".length()).trim();
// register a RegistryConfig with that id, or fix the reference
} else throw e;
} Prevention
- Centralize registry ids in a constant/enum to avoid typos.
- In tests, assert that every referenced registry id is registered before export.
- Use Spring bean id references so IDEs catch mismatches.
When it happens
Trigger: Setting `registry="reg1,reg2"` or `registryIds` on a service/reference config where 'reg1' or 'reg2' was never registered as a RegistryConfig (e.g. missing <dubbo:registry id="reg1">). Also occurs when a registry id is misspelled or removed from config while still referenced.
Common situations: Multi-registry setups where one registry id is typo'd. Refactoring that renames a registry bean id without updating all references. Spring Boot property-based config (dubbo.registries.reg1.address) where the key prefix doesn't match the referenced id.
Related errors
- url missing protocol: "<url>"
- No registry config found or it's not a valid config! The reg
- Invalid configurator rule, please specify at least one param
- service field in configuration is null.
- Illegal affinity rule!
AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14).
Data as JSON: /api/errors/06b81d3cae9c46d3.
Report an issue: GitHub.