{"record":{"id":"453dd77fe523f428","repo":"apache/dubbo","slug":"e","errorCode":null,"errorMessage":"<e>","messagePattern":"<e>","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/config/MethodConfig.java","lineNumber":312,"sourceCode":"            if (StringUtils.isNotEmpty(onreturnMethod)) {\n                asyncMethodInfo.setOnreturnMethod(getMethodByName(getOnreturn().getClass(), onreturnMethod));\n            }\n\n            if (StringUtils.isNotEmpty(onthrowMethod)) {\n                asyncMethodInfo.setOnthrowMethod(getMethodByName(getOnthrow().getClass(), onthrowMethod));\n            }\n        } catch (Exception e) {\n            throw new IllegalStateException(e.getMessage(), e);\n        }\n\n        return asyncMethodInfo;\n    }\n\n    private java.lang.reflect.Method getMethodByName(Class<?> clazz, String methodName) {\n        try {\n            return ReflectUtils.findMethodByMethodName(clazz, methodName);\n        } catch (Exception e) {\n            throw new IllegalStateException(e);\n        }\n    }\n\n    /**\n     * Set default field values of MethodConfig.\n     *\n     * @see org.apache.dubbo.config.annotation.Method\n     */\n    @Override\n    protected void checkDefault() {\n        super.checkDefault();\n\n        // set default field values\n        // org.apache.dubbo.config.annotation.Method.isReturn() default true;\n        if (isReturn() == null) {\n            setReturn(true);\n        }\n","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/config/MethodConfig.java#L294-L330","documentation":"Thrown by MethodConfig.getMethodByName when ReflectUtils.findMethodByMethodName cannot locate the named method on the callback object's class. The underlying exception (typically a NoSuchMethodException wrapper) is re-thrown as an IllegalStateException without a custom message, so only the cause carries detail. It is the leaf cause behind the async-callback resolution failure surfaced by error 341.","triggerScenarios":"Calling convertMethodConfig2AsyncInfo where oninvokeMethod/onreturnMethod/onthrowMethod names a method that does not exist (or is not uniquely resolvable) on the getOninvoke()/getOnreturn()/getOnthrow() instance's class.","commonSituations":"Method name typo in @Method annotation. Callback instance class changed without updating the annotation. Overloaded methods causing ambiguous resolution in ReflectUtils.findFieldByMethodName. Private or package-private callback methods invisible to reflection.","solutions":["Confirm the callback method exists, is public, and is uniquely named (no overload ambiguity) on the callback instance class.","Inspect e.getCause() for the concrete ReflectUtils error message.","Align the annotation/MethodConfig method name with the actual callback method name."],"exampleFix":"// before\npublic class Callback { public void onInvoke(Object result) {} }\nmethodConfig.setOninvokeMethod(\"onInoke\"); // typo\n\n// after\nmethodConfig.setOninvokeMethod(\"onInvoke\");","handlingStrategy":"validation","validationCode":"// Pre-validate the callback method name resolves uniquely\njava.lang.reflect.Method m = ReflectUtils.findMethodByMethodName(callbackInstance.getClass(), methodName);\n// if this throws, fix the name before calling convertMethodConfig2AsyncInfo()","typeGuard":null,"tryCatchPattern":"try {\n    methodConfig.convertMethodConfig2AsyncInfo();\n} catch (IllegalStateException e) {\n    Throwable root = e.getCause() != null ? e.getCause() : e;\n    // root.getMessage() reveals the missing/ambiguous method\n    throw new ConfigurationException(\"Invalid async callback: \" + root.getMessage(), root);\n}","preventionTips":["Keep callback method names in sync with the implementation (rename-safe tooling).","Avoid overloading callback methods to prevent ambiguous resolution.","Add a unit test asserting each configured callback method resolves via reflection."],"tags":["async-callback","reflection","config"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}