alibaba/nacos · critical · NacosException
-400
-400
Error message
No server list provider found.
What it means
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.
Source
Thrown at client-basic/src/main/java/com/alibaba/nacos/client/address/AbstractServerListManager.java:103
Collection<ServerListProvider> serverListProviders =
NacosServiceLoader.load(ServerListProvider.class);
Collection<ServerListProvider> sorted = serverListProviders.stream()
.sorted((a, b) -> b.getOrder() - a.getOrder()).collect(Collectors.toList());
for (ServerListProvider each : sorted) {
boolean matchResult = each.match(properties);
LOGGER.info("Load and match ServerListProvider {}, match result: {}",
each.getClass().getCanonicalName(),
matchResult);
if (matchResult) {
this.serverListProvider = each;
LOGGER.info("Will use {} as ServerListProvider",
this.serverListProvider.getClass().getCanonicalName());
break;
}
}
if (null == serverListProvider) {
LOGGER.error("No server list provider found, SPI load size: {}", sorted.size());
throw new NacosException(NacosException.CLIENT_INVALID_PARAM,
"No server list provider found.");
}
this.serverListProvider.init(properties, getNacosRestTemplate());
}
public String getServerName() {
return getModuleName() + "-" + serverListProvider.getServerName();
}
public String getContextPath() {
return serverListProvider.getContextPath();
}
public String getNamespace() {
return serverListProvider.getNamespace();
}
public String getAddressSource() {View on GitHub (pinned to 9b989acdf1)
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.
Example fix
// before
Properties props = new Properties();
props.setProperty("namespace", "test");
NamingService ns = NamingFactory.createNamingService(props);
// after
Properties props = new Properties();
props.setProperty(PropertyKeyConst.SERVER_ADDR, "127.0.0.1:8848");
props.setProperty("namespace", "test");
NamingService ns = NamingFactory.createNamingService(props); Defensive patterns
Strategy: validation
Validate before calling
String serverAddr = properties.getProperty(PropertyKeyConst.SERVER_ADDR);
String endpoint = properties.getProperty(PropertyKeyConst.ENDPOINT);
if (StringUtils.isBlank(serverAddr) && StringUtils.isBlank(endpoint)) {
throw new IllegalArgumentException("Either SERVER_ADDR or ENDPOINT must be set in client properties.");
} Try / catch
try {
serverListManager.start();
} catch (NacosException e) {
if (e.getErrCode() == NacosException.CLIENT_INVALID_PARAM) {
// Provide a clear message about missing serverAddr or endpoint
throw new IllegalStateException("No ServerListProvider matched. Set SERVER_ADDR or ENDPOINT.", e);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- [http-client] invalid read timeout:{}
- invalid PER_TASK_CONFIG_SIZE, expected value type double
- Illegal url path expression
- 400
- 500
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/2c390e7138bb2f03.
Report an issue: GitHub.