{"record":{"id":"a26a8f72d215a4fd","repo":"apache/dubbo","slug":"failfast-invoke-providers-invoker-geturl-load","errorCode":null,"errorMessage":"Failfast invoke providers {invoker.getUrl()} {loadbalance.getClass().getSimpleName()} for service {getInterface().getName()} method {RpcUtils.getMethodName(invocation)} on consumer {NetUtils.getLocalHost()} use dubbo version {Version.getVersion()}, but no luck to perform the invocation. Last error is: {e.getMessage()}","messagePattern":"Failfast invoke providers (.+?) (.+?) for service (.+?) method (.+?) on consumer (.+?) use dubbo version (.+?), but no luck to perform the invocation\\. Last error is: (.+?)","errorType":"exception","errorClass":"RpcException","httpStatus":null,"severity":"error","filePath":"dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailfastClusterInvoker.java","lineNumber":53,"sourceCode":" * <a href=\"http://en.wikipedia.org/wiki/Fail-fast\">Fail-fast</a>\n */\npublic class FailfastClusterInvoker<T> extends AbstractClusterInvoker<T> {\n\n    public FailfastClusterInvoker(Directory<T> directory) {\n        super(directory);\n    }\n\n    @Override\n    public Result doInvoke(Invocation invocation, List<Invoker<T>> invokers, LoadBalance loadbalance)\n            throws RpcException {\n        Invoker<T> invoker = select(loadbalance, invocation, invokers, null);\n        try {\n            return invokeWithContext(invoker, invocation);\n        } catch (Throwable e) {\n            if (e instanceof RpcException && ((RpcException) e).isBiz()) { // biz exception.\n                throw (RpcException) e;\n            }\n            throw new RpcException(\n                    e instanceof RpcException ? ((RpcException) e).getCode() : 0,\n                    \"Failfast invoke providers \" + invoker.getUrl() + \" \"\n                            + loadbalance.getClass().getSimpleName()\n                            + \" for service \" + getInterface().getName()\n                            + \" method \" + RpcUtils.getMethodName(invocation) + \" on consumer \"\n                            + NetUtils.getLocalHost()\n                            + \" use dubbo version \" + Version.getVersion()\n                            + \", but no luck to perform the invocation. Last error is: \" + e.getMessage(),\n                    e.getCause() != null ? e.getCause() : e);\n        }\n    }\n}\n","sourceCodeStart":35,"sourceCodeEnd":66,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailfastClusterInvoker.java#L35-L66","documentation":"Thrown by FailfastClusterInvoker.doInvoke() when the single selected provider invocation fails with a non-business (non-biz) exception. The failfast strategy performs exactly one attempt (no retry) and is intended for non-idempotent writes; any network/timeout/system error is wrapped and rethrown with this message. Business (biz) exceptions are rethrown unchanged.","triggerScenarios":"A failfast-cluster RPC where the one selected provider throws a non-biz RpcException (timeout, connection refused, serialization error) or a Throwable. select() picks one invoker; invokeWithContext() fails; the catch wraps it.","commonSituations":"Timeout too short for the operation; provider temporarily unreachable; transient network error on the single attempt; using failfast for a call that needs retry (it will not retry).","solutions":["Inspect the wrapped 'Last error' cause: for timeouts raise the method/invocation timeout; for connection errors fix provider reachability.","If the operation is idempotent and benefits from retry, switch the cluster to 'failover' and set appropriate retries.","For genuinely non-idempotent writes, keep failfast but ensure the single attempt has sufficient timeout and the provider is healthy."],"exampleFix":"# before: failfast times out on the single attempt\n@DubboReference(cluster = \"failfast\") // default timeout too short\nprivate OrderService orderService;\n\n# after: raise timeout, or switch to failover if idempotent\n@DubboReference(cluster = \"failfast\", timeout = 5000, methods = {@Method(name=\"createOrder\", timeout=8000)})\nprivate OrderService orderService;","handlingStrategy":"try-catch","validationCode":"// Pre-flight: confirm at least one provider and a sane timeout for failfast\nif (CollectionUtils.isEmpty(directory.getAllInvokers())) {\n    return fallback();\n}\n// ensure timeout fits the operation before invoking with failfast (no retry)","typeGuard":null,"tryCatchPattern":"try {\n    return failfastService.createOrder(req);\n} catch (RpcException e) {\n    if (!e.isBiz() && e.getMessage().contains(\"Failfast invoke\")) {\n        // non-biz single-attempt failure; do NOT retry for non-idempotent writes\n        log.error(\"Failfast call failed: \" + e.getMessage());\n        throw new OrderSubmitException(\"order submission failed\", e);\n    }\n    throw e;\n}","preventionTips":["Set a method timeout large enough for the single failfast attempt.","Do not retry non-idempotent failfast calls on non-biz errors.","Switch to failover only if the operation is idempotent."],"tags":["cluster","failfast","timeout","no-retry"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}