{"record":{"id":"1d9a2eaf7d80a8e3","repo":"apache/shenyu","slug":"gateway-address-not-found-from-registry","errorCode":null,"errorMessage":"Gateway address not found from registry.","messagePattern":"Gateway address not found from registry\\.","errorType":"exception","errorClass":"ShenyuException","httpStatus":null,"severity":"error","filePath":"shenyu-sdk/shenyu-sdk-core/src/main/java/org/apache/shenyu/sdk/core/client/AbstractShenyuSdkClient.java","lineNumber":163,"sourceCode":"     *\n     * @param request the request.\n     * @return {@linkplain String}\n     */\n    private String loadBalancerInstances(final ShenyuRequest request) {\n        // all addresses of registry\n        final List<Upstream> upstreams;\n        if (Objects.isNull(registerRepository)) {\n            List<String> serverList = Arrays.asList(registerConfig.getServerLists().split(\",\"));\n            if (serverList.isEmpty()) {\n                throw new ShenyuException(\"illegal param, serverLists configuration required if registerType equals local.\");\n            }\n            upstreams = serverList.stream()\n                    .map(serverAddress -> Upstream.builder().url(UriUtils.appendScheme(serverAddress, scheme)).build())\n                    .collect(Collectors.toList());\n        } else {\n            List<InstanceEntity> instanceRegisters = registerRepository.selectInstances(request.getName());\n            if (ObjectUtils.isEmpty(instanceRegisters)) {\n                throw new ShenyuException(\"Gateway address not found from registry.\");\n            }\n            upstreams = instanceRegisters.stream()\n                    .map(instanceRegister -> {\n                        final String instanceUrl = String.join(Constants.COLONS, instanceRegister.getHost(), Integer.toString(instanceRegister.getPort()));\n                        return Upstream.builder().url(UriUtils.appendScheme(instanceUrl, scheme)).build();\n                    })\n                    .collect(Collectors.toList());\n        }\n        // loadBalancer upstreams\n        LoadBalanceData data = new LoadBalanceData();\n        data.setHeaders(request.getHeaders());\n        data.setHttpMethod(request.getHttpMethod().name());\n        final Upstream upstream = LoadBalancerFactory.selector(upstreams, algorithm, data);\n        return replaceUrl(upstream.getUrl(), request.getUrl());\n    }\n\n    private String replaceUrl(final String url, final String sourceUrl) {\n        final URI uri = URI.create(sourceUrl);","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-sdk/shenyu-sdk-core/src/main/java/org/apache/shenyu/sdk/core/client/AbstractShenyuSdkClient.java#L145-L181","documentation":"In the registered (non-local) mode, loadBalancerInstances asks the register repository for instances of the request's service name; when selectInstances returns nothing the SDK cannot route the request and throws a ShenyuException.","triggerScenarios":"shenyuRequest -> loadBalancerInstances where registerRepository.selectInstances(request.getName()) returns null or an empty list — the service has no registered/healthy instances.","commonSituations":"Gateway service name mismatch between SDK request and registered instances; all gateway instances down or deregistered; registry (consul/zookeeper/etc.) not synced or client connected to the wrong registry namespace; SDK called before the first gateway instance registered.","solutions":["Verify request.getName() matches the service name under which gateway instances registered","Check the registry (e.g. Consul UI) for live instances of that service","Confirm SDK registry connection settings (serverLists, namespace) point at the registry the gateways use","Start at least one healthy gateway instance and wait for registration before issuing SDK requests"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"List<InstanceEntity> instances = registerRepository.selectInstances(name); if (instances == null || instances.isEmpty()) { useFallbackAddress(); }","typeGuard":null,"tryCatchPattern":"try { sdkClient.send(request); } catch (ShenyuException e) { log.warn(\"no instances for {} in registry; retrying/failing over\", request.getName()); retryWithBackoff(); }","preventionTips":["Verify service-name consistency between SDK calls and registration","Watch registry instance counts and alert on zero","Point SDK and gateways at the same registry/namespace"],"tags":["sdk","registry","loadbalancer","upstream"],"backgroundTag":"empty-result-set","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"}