{"record":{"id":"cee6203442217c2d","repo":"apache/shenyu","slug":"no-fallback-available","errorCode":null,"errorMessage":"No fallback available.","messagePattern":"No fallback available\\.","errorType":"exception","errorClass":"NoFallbackAvailableException","httpStatus":null,"severity":"error","filePath":"shenyu-sdk/shenyu-sdk-spring/src/main/java/org/apache/shenyu/sdk/spring/proxy/ShenyuClientInvocationHandler.java","lineNumber":89,"sourceCode":"        fallbackFactory = getFallbackFactory(shenyuClientFactoryBean.getFallback(),\n                shenyuClientFactoryBean.getFallbackFactory());\n        buildMethodHandlerMap(apiClass, shenyuClient);\n    }\n\n    @Override\n    public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {\n\n        ShenyuClientMethodHandler handler = methodHandlerMap.get(method);\n        if (ObjectUtils.isEmpty(handler)) {\n            throw new ShenyuException(String.format(\"the method cannot be called, please check the annotation and configuration, method %s\", method.getName()));\n        }\n        Object result;\n        try {\n            result = handler.invoke(args);\n        } catch (Throwable throwable) {\n            LOG.error(\"ShenYu Client invoke error  \", throwable);\n            if (Objects.isNull(fallbackFactory)) {\n                throw new NoFallbackAvailableException(\"No fallback available.\", throwable);\n            }\n            Object fallback = fallbackFactory.create(throwable);\n            result = method.invoke(fallback, args);\n        }\n        return result;\n    }\n\n    private void buildMethodHandlerMap(final Class<?> apiClass, final ShenyuClient shenyuClient) {\n        // parseAndValidate RequestTemplate\n        final List<RequestTemplate> requestTemplates = contract.parseAndValidateRequestTemplate(apiClass, shenyuClientFactoryBean);\n\n        final ShenyuSdkClient shenyuSdkClient = applicationContext.getBean(ShenyuSdkClient.class);\n        final Map<String, AnnotatedParameterProcessor> annotatedParameterProcessorMap = applicationContext.getBeansOfType(AnnotatedParameterProcessor.class);\n        Collection<AnnotatedParameterProcessor> annotatedParameterProcessors = annotatedParameterProcessorMap.values();\n        annotatedParameterProcessors = annotatedParameterProcessors.stream().sorted(Comparator.comparing(AnnotatedParameterProcessor::order)).collect(Collectors.toList());\n        Map<Class<? extends Annotation>, AnnotatedParameterProcessor> annotatedArgumentProcessors = toAnnotatedArgumentProcessorMap(annotatedParameterProcessors);\n        for (RequestTemplate requestTemplate : requestTemplates) {\n            requestTemplate.setUrl(shenyuClientFactoryBean.getUrl());","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-sdk/shenyu-sdk-spring/src/main/java/org/apache/shenyu/sdk/spring/proxy/ShenyuClientInvocationHandler.java#L71-L107","documentation":"When the underlying remote call through ShenyuClientMethodHandler throws, invoke() checks for a configured fallbackFactory. If none is set it wraps the original cause in NoFallbackAvailableException(\"No fallback available.\"). The real failure reason is always the cause of this exception.","triggerScenarios":"Any remote-call failure (connection refused, timeout, non-2xx from the gateway, JSON decode error) on a @ShenyuClient proxy that was created without a fallbackFactory.","commonSituations":"Gateway down or port wrong; network partition or timeout under load; response body not deserializable; developer never wired a fallback because the client was assumed reliable.","solutions":["Inspect the cause of NoFallbackAvailableException (getCause()) to fix the root failure — connection, timeout, or serialization.","Provide a fallbackFactory when creating the client so failures degrade gracefully instead of propagating.","Fix connectivity to the gateway (host/port, firewall, gateway process running).","Add timeouts/retries appropriate to the operation so transient errors are absorbed."],"exampleFix":"// before\nShenyuClientFactoryBean factoryBean = new ShenyuClientFactoryBean(OrderApi.class, url);\n// after\nfactoryBean.setFallbackFactory(new OrderApiFallbackFactory()); // returns defaults on failure","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return orderApi.getById(id);\n} catch (NoFallbackAvailableException e) {\n    log.warn(\"shenyu call failed\", e.getCause());\n    return OrderDTO.empty(); // local default\n}","preventionTips":["Always configure a fallbackFactory for production clients.","Inspect e.getCause() to distinguish network, timeout, and decode failures.","Set explicit timeouts so failures surface predictably.","Monitor/logs Shenyu Client invoke error entries to catch root causes early."],"tags":["fallback","remote-call","resilience"],"backgroundTag":"missing-dependency","analyzedSha":"567142e07261b3e615ae8850b30f4421f455cc5d","analyzedAt":"2026-09-12T10:08:21.293Z","contentChangedAt":"2026-09-12T10:08:21.293Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}