{"record":{"id":"196e0c5f123dffc0","repo":"apache/dubbo","slug":"dubbo-method-name-attribute-is-required-please","errorCode":null,"errorMessage":"<dubbo:method> name attribute is required! Please check: <dubbo:service interface=\"<interfaceName>\" ... ><dubbo:method name=\"\" ... /></<dubbo:reference>","messagePattern":"<dubbo:method> name attribute is required! Please check: <dubbo:service interface=\"<interfaceName>\" \\.\\.\\. ><dubbo:method name=\"\" \\.\\.\\. /></<dubbo:reference>","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java","lineNumber":407,"sourceCode":"    }\n\n    /**\n     * it is used for skipping the check of interface since dubbo 3.2\n     * rest and triple protocol allow the service is implement class\n     */\n    protected void checkInterface() {}\n\n    protected boolean verifyMethodConfig(\n            MethodConfig methodConfig, Class<?> interfaceClass, boolean ignoreInvalidMethodConfig) {\n        String methodName = methodConfig.getName();\n        if (StringUtils.isEmpty(methodName)) {\n            String msg = \"<dubbo:method> name attribute is required! Please check: \" + \"<dubbo:service interface=\\\"\"\n                    + interfaceName + \"\\\" ... >\" + \"<dubbo:method name=\\\"\\\" ... /></<dubbo:reference>\";\n            if (ignoreInvalidMethodConfig) {\n                logger.warn(CONFIG_NO_METHOD_FOUND, \"\", \"\", msg);\n                return false;\n            } else {\n                throw new IllegalStateException(msg);\n            }\n        }\n\n        boolean hasMethod = Arrays.stream(interfaceClass.getMethods())\n                .anyMatch(method -> method.getName().equals(methodName));\n        if (!hasMethod) {\n            String msg = \"Found invalid method config, the interface \" + interfaceClass.getName()\n                    + \" not found method \\\"\" + methodName + \"\\\" : [\" + methodConfig + \"]\";\n            if (ignoreInvalidMethodConfig) {\n                logger.warn(CONFIG_NO_METHOD_FOUND, \"\", \"\", msg);\n                return false;\n            } else {\n                if (!isNeedCheckMethod()) {\n                    msg = \"Generic call: \" + msg;\n                    logger.warn(CONFIG_NO_METHOD_FOUND, \"\", \"\", msg);\n                } else {\n                    throw new IllegalStateException(msg);\n                }","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java#L389-L425","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"// before\n<dubbo:service interface=\"com.acme.Greeting\" >\n  <dubbo:method name=\"\" retries=\"3\"/>\n</dubbo:service>\n// after\n<dubbo:service interface=\"com.acme.Greeting\" >\n  <dubbo:method name=\"hello\" retries=\"3\"/>\n</dubbo:service>","handlingStrategy":"validation","validationCode":"void assertMethodConfigNamed(MethodConfig mc, Class<?> iface) {\n    if (mc.getName() == null || mc.getName().trim().isEmpty())\n        throw new IllegalStateException(\"<dubbo:method> name required for \" + iface.getName());\n}","typeGuard":null,"tryCatchPattern":"try {\n    serviceConfig.export();\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"name attribute is required\")) { /* set method name */ }\n    throw e;\n}","preventionTips":["Always set name on every <dubbo:method> / MethodConfig.","Lint method configs in a startup check.","Avoid blank method-name placeholders."],"tags":["config","method-config","startup","export"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}