apache/dubbo · error · RpcException
Failed to invoke the method {methodName} in the service {get
Error message
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()} What it means
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.
Source
Thrown at dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java:116
+ le.getMessage(),
le);
}
success = true;
return result;
} catch (RpcException e) {
if (e.isBiz()) { // biz exception.
throw e;
}
le = e;
} catch (Throwable e) {
le = new RpcException(e.getMessage(), e);
} finally {
if (!success) {
providers.add(invoker.getUrl().getAddress());
}
}
}
throw new RpcException(
le.getCode(),
"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(),
le.getCause() != null ? le.getCause() : le);
}
private int calculateInvokeTimes(String methodName) {
int len = getUrl().getMethodParameter(methodName, RETRIES_KEY, DEFAULT_RETRIES) + 1;
RpcContext rpcContext = RpcContext.getClientAttachment();
Object retry = rpcContext.getObjectAttachment(RETRIES_KEY);
if (retry instanceof Number) {
len = ((Number) retry).intValue() + 1;View on GitHub (pinned to 3a3043227f)
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.
Example fix
# before: defaults (retries=2, short timeout) all attempts time out @DubboReference(cluster = "failover") private UserService userService; # after: more retries and longer timeout (only if idempotent) @DubboReference(cluster = "failover", retries = 4, timeout = 5000) private UserService userService;
Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight: confirm providers and tune retries/timeout for failover
if (CollectionUtils.isEmpty(directory.getAllInvokers())) {
return fallback();
}
// configure retries/timeout matching the operation's idempotency and provider health
// @DubboReference(cluster="failover", retries=3, timeout=5000) Try / catch
try {
return failoverService.query(id);
} catch (RpcException e) {
if (e.getMessage().contains("Tried") && e.getMessage().contains("times of the providers")) {
// all retries exhausted; degrade or alert — do not add another outer retry loop
log.error("Failover exhausted: " + e.getMessage());
return fallback();
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Failed to forking invoke provider {selected}, but no luck to
- Rpc cluster invoker for {getInterface()} on consumer {NetUti
- 6
- No provider available in {invokers}
- Failfast invoke providers {invoker.getUrl()} {loadbalance.ge
AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14).
Data as JSON: /api/errors/040f466b52897d95.
Report an issue: GitHub.