{"record":{"id":"2c390e7138bb2f03","repo":"alibaba/nacos","slug":"400-2c390e","errorCode":"-400","errorMessage":"No server list provider found.","messagePattern":"No server list provider found\\.","errorType":"exception","errorClass":"NacosException","httpStatus":null,"severity":"critical","filePath":"client-basic/src/main/java/com/alibaba/nacos/client/address/AbstractServerListManager.java","lineNumber":103,"sourceCode":"        Collection<ServerListProvider> serverListProviders =\n            NacosServiceLoader.load(ServerListProvider.class);\n        Collection<ServerListProvider> sorted = serverListProviders.stream()\n            .sorted((a, b) -> b.getOrder() - a.getOrder()).collect(Collectors.toList());\n        for (ServerListProvider each : sorted) {\n            boolean matchResult = each.match(properties);\n            LOGGER.info(\"Load and match ServerListProvider {}, match result: {}\",\n                each.getClass().getCanonicalName(),\n                matchResult);\n            if (matchResult) {\n                this.serverListProvider = each;\n                LOGGER.info(\"Will use {} as ServerListProvider\",\n                    this.serverListProvider.getClass().getCanonicalName());\n                break;\n            }\n        }\n        if (null == serverListProvider) {\n            LOGGER.error(\"No server list provider found, SPI load size: {}\", sorted.size());\n            throw new NacosException(NacosException.CLIENT_INVALID_PARAM,\n                \"No server list provider found.\");\n        }\n        this.serverListProvider.init(properties, getNacosRestTemplate());\n    }\n    \n    public String getServerName() {\n        return getModuleName() + \"-\" + serverListProvider.getServerName();\n    }\n    \n    public String getContextPath() {\n        return serverListProvider.getContextPath();\n    }\n    \n    public String getNamespace() {\n        return serverListProvider.getNamespace();\n    }\n    \n    public String getAddressSource() {","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/client-basic/src/main/java/com/alibaba/nacos/client/address/AbstractServerListManager.java#L85-L121","documentation":"Thrown by AbstractServerListManager.start() with error code CLIENT_INVALID_PARAM (-400) when none of the SPI-loaded ServerListProvider implementations match the supplied NacosClientProperties. The manager iterates providers sorted by descending order and calls each provider's match(properties) method; if all return false, the client cannot determine how to discover servers. The log line includes the SPI load size for diagnosis.","triggerScenarios":"The client properties do not contain a server address list (PropertyKeyConst.SERVER_ADDR) and no endpoint is configured (PropertyKeyConst.ENDPOINT), so no ServerListProvider's match() returns true. This can also happen if the SPI configuration file (META-INF/nacos/...) for ServerListProvider is missing from the classpath, e.g. due to a fat-jar shading issue.","commonSituations":"Missing 'serverAddr' or 'endpoint' property when constructing NamingService/ConfigService; classpath shading strips SPI metadata files; custom ServerListProvider implementations whose match() logic has a bug; running in environments where only a subset of nacos-client modules are on the classpath.","solutions":["Ensure your client Properties include either PropertyKeyConst.SERVER_ADDR (a comma-separated host:port list) or PropertyKeyConst.ENDPOINT.","Check the log for 'SPI load size: 0' — if 0, verify META-INF/nacos/com.alibaba.nacos.client.address.ServerListProvider is on the classpath (common in fat-jar / shading setups).","If using a custom ServerListProvider, verify its match() method returns true for your configuration and the SPI file lists it.","Upgrade or re-bundle the nacos-client JAR to ensure all provider modules are included."],"exampleFix":"// before\nProperties props = new Properties();\nprops.setProperty(\"namespace\", \"test\");\nNamingService ns = NamingFactory.createNamingService(props);\n\n// after\nProperties props = new Properties();\nprops.setProperty(PropertyKeyConst.SERVER_ADDR, \"127.0.0.1:8848\");\nprops.setProperty(\"namespace\", \"test\");\nNamingService ns = NamingFactory.createNamingService(props);","handlingStrategy":"validation","validationCode":"String serverAddr = properties.getProperty(PropertyKeyConst.SERVER_ADDR);\nString endpoint = properties.getProperty(PropertyKeyConst.ENDPOINT);\nif (StringUtils.isBlank(serverAddr) && StringUtils.isBlank(endpoint)) {\n    throw new IllegalArgumentException(\"Either SERVER_ADDR or ENDPOINT must be set in client properties.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    serverListManager.start();\n} catch (NacosException e) {\n    if (e.getErrCode() == NacosException.CLIENT_INVALID_PARAM) {\n        // Provide a clear message about missing serverAddr or endpoint\n        throw new IllegalStateException(\"No ServerListProvider matched. Set SERVER_ADDR or ENDPOINT.\", e);\n    }\n    throw e;\n}","preventionTips":["Always set either SERVER_ADDR or ENDPOINT in client properties before constructing NamingService/ConfigService.","If using shading or fat-jars, verify META-INF/nacos/ SPI files are preserved.","Log the SPI load size during development to confirm providers are on the classpath."],"tags":["spi","server-discovery","client-init","configuration"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}