{"record":{"id":"2aeea23d2b35b4f6","repo":"alibaba/spring-cloud-alibaba","slug":"method-handler-not-found-for-method-method","errorCode":null,"errorMessage":"Method handler not found for method: {method}","messagePattern":"Method handler not found for method: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/feign/SentinelInvocationHandler.java","lineNumber":98,"sourceCode":"\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn equals(otherHandler);\n\t\t\t}\n\t\t\tcatch (IllegalArgumentException e) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\telse if (\"hashCode\".equals(method.getName())) {\n\t\t\treturn hashCode();\n\t\t}\n\t\telse if (\"toString\".equals(method.getName())) {\n\t\t\treturn toString();\n\t\t}\n\n\t\tObject result;\n\t\tMethodHandler methodHandler = this.dispatch.get(method);\n\t\tif (methodHandler == null) {\n\t\t\tthrow new IllegalStateException(\"Method handler not found for method: \" + method);\n\t\t}\n\t\t// only handle by HardCodedTarget\n\t\tif (target instanceof Target.HardCodedTarget hardCodedTarget) {\n\t\t\tMethodMetadata methodMetadata = SentinelContractHolder.METADATA_MAP\n\t\t\t\t\t.get(hardCodedTarget.type().getName()\n\t\t\t\t\t\t\t+ Feign.configKey(hardCodedTarget.type(), method));\n\t\t\t// resource default is HttpMethod:protocol://url\n\t\t\tif (methodMetadata == null) {\n\t\t\t\tresult = methodHandler.invoke(args);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tString resourceName = methodMetadata.template().method().toUpperCase(Locale.ROOT)\n\t\t\t\t\t\t+ \":\" + hardCodedTarget.url() + methodMetadata.template().path();\n\t\t\t\tEntry entry = null;\n\t\t\t\ttry {\n\t\t\t\t\tContextUtil.enter(resourceName);\n\t\t\t\t\tentry = SphU.entry(resourceName, EntryType.OUT, 1, args);\n\t\t\t\t\tresult = methodHandler.invoke(args);","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/alibaba/spring-cloud-alibaba/blob/115d5901102009492e05d5ec18c3f79cad4077d0/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/feign/SentinelInvocationHandler.java#L80-L116","documentation":"SentinelInvocationHandler.invoke() looks up the MethodHandler for the called method in its dispatch map. If the method being invoked is not Object.class identity methods (equals/hashCode/toString) and has no entry in dispatch, this IllegalStateException is thrown at call time. It means the feign contract did not register a handler for that method, typically a default or static method or an unannotated method leaking through the proxy.","triggerScenarios":"Calling a default method or a method not covered by the feign contract on the proxied interface. Reflectively invoking a method object that is a bridge/synthetic variant not present in dispatch. A contract customization that excludes methods the client still calls.","commonSituations":"Adding a default helper method to a feign interface and calling it directly. Custom Contract beans that drop some @RequestLine methods. Version skew between the interface and the registered metadata.","solutions":["Only call methods that the feign contract maps (annotated interface methods).","Move helper/default logic out of the feign interface into a separate service.","If using a custom Contract, ensure it registers every callable method.","Rebuild the feign client metadata so dispatch is populated for all intended methods."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"void assertDispatched(Method m, Map<Method,?> dispatch) {\n  if (m.getDeclaringClass() == Object.class) return;\n  if (!dispatch.containsKey(m)) throw new IllegalStateException(\"No handler for \" + m);\n}","typeGuard":"static boolean isHandled(Method m, Map<Method,?> dispatch) {\n  return m.getDeclaringClass() == Object.class || dispatch.containsKey(m);\n}","tryCatchPattern":"try { proxy.callMethod(); }\ncatch (IllegalStateException e) { if (e.getMessage().contains(\"handler not found\")) { /* route to default impl */ } else throw e; }","preventionTips":["Call only contract-mapped interface methods.","Move default/helper methods out of feign interfaces.","Keep custom Contract beans in sync with the interface."],"tags":["sentinel","feign","invocation","runtime"],"backgroundTag":null,"analyzedSha":"115d5901102009492e05d5ec18c3f79cad4077d0","analyzedAt":"2026-08-14T04:47:13.900Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}