apache/dubbo · error · IllegalArgumentException
The address of metadata report is invalid.
Error message
The address of metadata report is invalid.
What it means
Thrown by MetadataReportConfig.toUrl() when the configured metadata report address is null or empty. toUrl() converts the address string into a Dubbo URL; an empty address cannot yield a valid URL, so it rejects early with IllegalArgumentException. This is distinct from URL parse errors which surface later from URL.valueOf().
Source
Thrown at dubbo-common/src/main/java/org/apache/dubbo/config/MetadataReportConfig.java:159
public MetadataReportConfig() {}
public MetadataReportConfig(ApplicationModel applicationModel) {
super(applicationModel);
}
public MetadataReportConfig(String address) {
setAddress(address);
}
public MetadataReportConfig(ApplicationModel applicationModel, String address) {
super(applicationModel);
setAddress(address);
}
public URL toUrl() throws IllegalArgumentException {
String address = this.getAddress();
if (isEmpty(address)) {
throw new IllegalArgumentException("The address of metadata report is invalid.");
}
Map<String, String> map = new HashMap<>();
URL url = URL.valueOf(address, getScopeModel());
// Issue : https://github.com/apache/dubbo/issues/6491
// Append the parameters from address
map.putAll(url.getParameters());
// Append or overrides the properties as parameters
appendParameters(map, this);
// Normalize the parameters
map.putAll(convert(map, null));
// put the protocol of URL as the "metadata"
map.put(METADATA, isEmpty(url.getProtocol()) ? map.get(PROTOCOL_KEY) : url.getProtocol());
return new ServiceConfigURL(
METADATA,
StringUtils.isBlank(url.getUsername()) ? this.getUsername() : url.getUsername(),
StringUtils.isBlank(url.getPassword()) ? this.getPassword() : url.getPassword(),
url.getHost(),
url.getPort(),View on GitHub (pinned to 3a3043227f)
Solutions
- Provide a valid metadata report address (e.g. 'zookeeper://127.0.0.1:2181').
- If no metadata center is needed, do not register a MetadataReportConfig at all.
- Ensure the address is set before the metadata report is initialized (before service export/reference).
Example fix
// before new MetadataReportConfig(applicationModel, ""); // after new MetadataReportConfig(applicationModel, "zookeeper://127.0.0.1:2181");
Defensive patterns
Strategy: validation
Validate before calling
String address = config.getAddress();
if (address == null || address.trim().isEmpty()) {
throw new IllegalArgumentException("metadata report address is empty");
}
// safe to call toUrl()
URL url = config.toUrl(); Type guard
static boolean hasValidMetadataAddress(MetadataReportConfig c) {
String a = c.getAddress();
return a != null && !a.trim().isEmpty();
} Try / catch
try {
URL url = metadataReportConfig.toUrl();
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("address of metadata report is invalid")) {
metadataReportConfig.setAddress("zookeeper://127.0.0.1:2181");
} else throw e;
} Prevention
- Always set the metadata report address when registering a MetadataReportConfig.
- If no metadata center is needed, omit the config entirely.
- Validate address is non-empty in a config sanity test.
When it happens
Trigger: Constructing MetadataReportConfig with a null/empty address, or calling toUrl() after address was never set. Occurs during metadata report initialization when the metadata center address property is missing.
Common situations: Configuring <dubbo:metadata-report/> with no address attribute, or dubbo.metadata-report.address left blank while expecting a default. Programmatic config where setAddress() is skipped.
Related errors
- Invalid url, password without username!
- Invalid url, password without username!
- url missing protocol: "${fullURLStr}"
- Invalid configurator rule, please specify at least one param
- service field in configuration is null.
AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14).
Data as JSON: /api/errors/907c3ae893dad3c2.
Report an issue: GitHub.