apache/dubbo · error · IllegalStateException
<dubbo:method> name attribute is required! Please check: <du
Error message
<dubbo:method> name attribute is required! Please check: <dubbo:service interface="<interfaceName>" ... ><dubbo:method name="" ... /></<dubbo:reference>
What it means
Thrown by AbstractInterfaceConfig.verifyMethodConfig: a MethodConfig has an empty/null name and the 'ignore invalid method config' flag is false. Dubbo requires every <dubbo:method> to declare which interface method it configures; an unnamed method config is rejected.
Source
Thrown at dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java:407
}
/**
* it is used for skipping the check of interface since dubbo 3.2
* rest and triple protocol allow the service is implement class
*/
protected void checkInterface() {}
protected boolean verifyMethodConfig(
MethodConfig methodConfig, Class<?> interfaceClass, boolean ignoreInvalidMethodConfig) {
String methodName = methodConfig.getName();
if (StringUtils.isEmpty(methodName)) {
String msg = "<dubbo:method> name attribute is required! Please check: " + "<dubbo:service interface=\""
+ interfaceName + "\" ... >" + "<dubbo:method name=\"\" ... /></<dubbo:reference>";
if (ignoreInvalidMethodConfig) {
logger.warn(CONFIG_NO_METHOD_FOUND, "", "", msg);
return false;
} else {
throw new IllegalStateException(msg);
}
}
boolean hasMethod = Arrays.stream(interfaceClass.getMethods())
.anyMatch(method -> method.getName().equals(methodName));
if (!hasMethod) {
String msg = "Found invalid method config, the interface " + interfaceClass.getName()
+ " not found method \"" + methodName + "\" : [" + methodConfig + "]";
if (ignoreInvalidMethodConfig) {
logger.warn(CONFIG_NO_METHOD_FOUND, "", "", msg);
return false;
} else {
if (!isNeedCheckMethod()) {
msg = "Generic call: " + msg;
logger.warn(CONFIG_NO_METHOD_FOUND, "", "", msg);
} else {
throw new IllegalStateException(msg);
}View on GitHub (pinned to 3a3043227f)
Solutions
- Set the name attribute on the <dubbo:method> to an actual method of the interface.
- If configuring programmatically, call methodConfig.setName("methodName") matching the interface.
- If the method config is not needed, remove the <dubbo:method> element.
- As a temporary workaround set dubbo.config.ignore-invalid-method-config=true (not recommended; hides real misconfigs).
Example fix
// before <dubbo:service interface="com.acme.Greeting" > <dubbo:method name="" retries="3"/> </dubbo:service> // after <dubbo:service interface="com.acme.Greeting" > <dubbo:method name="hello" retries="3"/> </dubbo:service>
Defensive patterns
Strategy: validation
Validate before calling
void assertMethodConfigNamed(MethodConfig mc, Class<?> iface) {
if (mc.getName() == null || mc.getName().trim().isEmpty())
throw new IllegalStateException("<dubbo:method> name required for " + iface.getName());
} Try / catch
try {
serviceConfig.export();
} catch (IllegalStateException e) {
if (e.getMessage().contains("name attribute is required")) { /* set method name */ }
throw e;
} Prevention
- Always set name on every <dubbo:method> / MethodConfig.
- Lint method configs in a startup check.
- Avoid blank method-name placeholders.
When it happens
Trigger: A MethodConfig is added (XML <dubbo:method name=""> or programmatic methodConfig without setName) with a blank name, and dubbo.config.ignore-invalid-method-config is false (default). verifyMethodConfig throws at startup during interface method verification.
Common situations: Spring XML <dubbo:method> element with a missing or empty name attribute. Programmatic MethodConfig created without calling setName. A templating/placeholder bug left the method name blank. Copy-paste of a method config block with the name removed.
Related errors
- Found invalid method config, the interface <interfaceClass.g
- No registry config found or it's not a valid config! The reg
- The local implementation class <localClass.getName()> not im
- More than 1 default extension name on extension {}: {}
- url missing protocol: "<url>"
AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14).
Data as JSON: /api/errors/196e0c5f123dffc0.
Report an issue: GitHub.