{"record":{"id":"040f466b52897d95","repo":"apache/dubbo","slug":"failed-to-invoke-the-method-methodname-in-the-se","errorCode":null,"errorMessage":"Failed to invoke the method {methodName} in the service {getInterface().getName()}. Tried {len} times of the providers {providers} ({providers.size()}/{copyInvokers.size()}) from the registry {directory.getUrl().getAddress()} on the consumer {NetUtils.getLocalHost()} using the dubbo version {Version.getVersion()}. Last error is: {le.getMessage()}","messagePattern":"Failed to invoke the method (.+?) in the service (.+?)\\. Tried (.+?) times of the providers (.+?) \\((.+?)/(.+?)\\) from the registry (.+?) on the consumer (.+?) using the dubbo version (.+?)\\. Last error is: (.+?)","errorType":"exception","errorClass":"RpcException","httpStatus":null,"severity":"error","filePath":"dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java","lineNumber":116,"sourceCode":"                                    + le.getMessage(),\n                            le);\n                }\n                success = true;\n                return result;\n            } catch (RpcException e) {\n                if (e.isBiz()) { // biz exception.\n                    throw e;\n                }\n                le = e;\n            } catch (Throwable e) {\n                le = new RpcException(e.getMessage(), e);\n            } finally {\n                if (!success) {\n                    providers.add(invoker.getUrl().getAddress());\n                }\n            }\n        }\n        throw new RpcException(\n                le.getCode(),\n                \"Failed to invoke the method \"\n                        + methodName + \" in the service \" + getInterface().getName()\n                        + \". Tried \" + len + \" times of the providers \" + providers\n                        + \" (\" + providers.size() + \"/\" + copyInvokers.size()\n                        + \") from the registry \" + directory.getUrl().getAddress()\n                        + \" on the consumer \" + NetUtils.getLocalHost() + \" using the dubbo version \"\n                        + Version.getVersion() + \". Last error is: \"\n                        + le.getMessage(),\n                le.getCause() != null ? le.getCause() : le);\n    }\n\n    private int calculateInvokeTimes(String methodName) {\n        int len = getUrl().getMethodParameter(methodName, RETRIES_KEY, DEFAULT_RETRIES) + 1;\n        RpcContext rpcContext = RpcContext.getClientAttachment();\n        Object retry = rpcContext.getObjectAttachment(RETRIES_KEY);\n        if (retry instanceof Number) {\n            len = ((Number) retry).intValue() + 1;","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java#L98-L134","documentation":"Thrown by FailoverClusterInvoker.doInvoke() after all retry attempts are exhausted with non-business exceptions. Failover retries the call on different providers (default retries + 1 attempts); if every attempt fails with a network/system RpcException, the loop ends and the last error is wrapped in this message. Business exceptions are rethrown immediately on first occurrence.","triggerScenarios":"A failover-cluster RPC where each of the configured attempts (retries+1, capped at provider count) fails with a non-biz RpcException — e.g., all selected providers time out or refuse the connection within the retry budget.","commonSituations":"All providers unhealthy or overloaded; timeout too short so every attempt times out; network partition affecting all providers; retries configured too low for the failure rate.","solutions":["Read the 'Last error' and provider list in the message to see which providers failed and why (timeout vs connection) and address the root cause.","Increase the method timeout (timeout) and/or retries (retries) if failures are transient, but ensure idempotency before raising retries.","Verify provider health/capacity and registry address list; if all providers are down, restore them."],"exampleFix":"# before: defaults (retries=2, short timeout) all attempts time out\n@DubboReference(cluster = \"failover\")\nprivate UserService userService;\n\n# after: more retries and longer timeout (only if idempotent)\n@DubboReference(cluster = \"failover\", retries = 4, timeout = 5000)\nprivate UserService userService;","handlingStrategy":"retry","validationCode":"// Pre-flight: confirm providers and tune retries/timeout for failover\nif (CollectionUtils.isEmpty(directory.getAllInvokers())) {\n    return fallback();\n}\n// configure retries/timeout matching the operation's idempotency and provider health\n// @DubboReference(cluster=\"failover\", retries=3, timeout=5000)","typeGuard":null,"tryCatchPattern":"try {\n    return failoverService.query(id);\n} catch (RpcException e) {\n    if (e.getMessage().contains(\"Tried\") && e.getMessage().contains(\"times of the providers\")) {\n        // all retries exhausted; degrade or alert — do not add another outer retry loop\n        log.error(\"Failover exhausted: \" + e.getMessage());\n        return fallback();\n    }\n    throw e;\n}","preventionTips":["Tune retries and timeout to match operation idempotency and provider reliability.","Do not wrap failover in another retry layer (compounds load during outages).","Investigate the 'Last error' to fix the underlying provider/network issue."],"tags":["cluster","failover","retry","timeout","no-provider"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}