{"record":{"id":"52996fc115021cf0","repo":"apache/shenyu","slug":"illegal-param-serverlists-configuration-required-if-52996f","errorCode":null,"errorMessage":"illegal param, serverLists configuration required if registerType equals local.","messagePattern":"illegal param, serverLists configuration required if registerType equals local\\.","errorType":"validation","errorClass":"ShenyuException","httpStatus":null,"severity":"error","filePath":"shenyu-sdk/shenyu-sdk-feign/src/main/java/org/apache/shenyu/sdk/feign/ShenyuDiscoveryClient.java","lineNumber":78,"sourceCode":"    public ShenyuDiscoveryClient(final ShenyuInstanceRegisterRepository registerRepository, final RegisterConfig registerConfig) {\n        this.registerRepository = registerRepository;\n        this.registerConfig = registerConfig;\n        Properties props = registerConfig.getProps();\n        this.algorithm = props.getProperty(\"algorithm\", \"roundRobin\");\n        this.scheme = props.getProperty(\"scheme\", HttpSchemeEnum.HTTP.getScheme());\n    }\n\n    /**\n     * Gets all ServiceInstances associated with a particular serviceId.\n     * @param serviceId The serviceId to query.\n     * @return A List of ServiceInstance.\n     */\n    public ServiceInstance getInstance(final String serviceId) {\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().map(serverAddress -> Upstream.builder().url(UriUtils.appendScheme(serverAddress, scheme)).build()).collect(Collectors.toList());\n        } else {\n            List<InstanceEntity> instanceRegisters = registerRepository.selectInstances(serviceId);\n            if (ObjectUtils.isEmpty(instanceRegisters)) {\n                throw new ShenyuException(\"Gateway address not found from registry.\");\n            }\n            upstreams = instanceRegisters.stream().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            }).collect(Collectors.toList());\n        }\n        // loadBalancer upstreams\n        if (CollectionUtils.isEmpty(upstreams)) {\n            LOG.error(\"The serviceId that named {} could not load balanced to at least one upstream.\", serviceId);\n        }\n        Upstream upstream = upstreams.get(0);\n        if (CollectionUtils.isNotEmpty(upstreams) && upstreams.size() > 1) {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-sdk/shenyu-sdk-feign/src/main/java/org/apache/shenyu/sdk/feign/ShenyuDiscoveryClient.java#L60-L96","documentation":"ShenyuDiscoveryClient.getInstance() supports two discovery modes. When no register repository is wired (local/static mode), it builds the instance list from registerConfig.getServerLists(); a null serverLists makes split() throw NPE, and a list that ends up empty is rejected with this ShenyuException. The SDK needs at least one gateway address to route SDK calls.","triggerScenarios":"Running the feign SDK with registerType local (or with registerRepository unset) while shenyu.sdk serverLists is absent or empty, then calling getInstance/serviceInstance for any serviceId.","commonSituations":"Missing serverLists key in application.yml; property name typo; copying config from a registry-based setup (zookeeper/nacos) that never sets serverLists; env var not injected in the deployment.","solutions":["Set the server lists in configuration, e.g. shenyu.register.serverLists: http://gw1:9195,http://gw2:9195 (comma-separated).","Verify the config actually reaches ShenyuRegisterConfig (correct prefix, profile active, env var present).","If you intend registry-based discovery, configure the registerType and repository so registerRepository is non-null instead of relying on serverLists."],"exampleFix":"// before (application.yml)\nshenyu:\n  register:\n    registerType: local\n// after\nshenyu:\n  register:\n    registerType: local\n    serverLists: http://localhost:9195","handlingStrategy":"validation","validationCode":"String serverLists = registerConfig.getServerLists();\nif (registerRepository == null && (serverLists == null || serverLists.isBlank())) {\n    throw new IllegalStateException(\"shenyu register.serverLists is required when no register repository is configured\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set serverLists whenever registerType is local or the repository is absent.","Validate SDK config at application startup, before the first SDK call.","Keep registry-based and static-based config examples separate to avoid mixing them."],"tags":["configuration","discovery","startup"],"backgroundTag":"missing-required-config-field","analyzedSha":"567142e07261b3e615ae8850b30f4421f455cc5d","analyzedAt":"2026-09-12T10:08:21.293Z","contentChangedAt":"2026-09-12T10:08:21.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}