alibaba/nacos · critical · NacosException

400

400

Error message

no server available

What it means

Thrown by NamingHttpClientProxy.reqApi when the server list is empty and the client is not in domain mode (NacosException.INVALID_PARAM = 400). The HTTP proxy has no server to send the request to. This fires before any retry logic because there is nothing to retry against.

Solutions

  1. Verify the serverAddr property in the client configuration points to a reachable Nacos server.
  2. Ensure the server list is populated before issuing naming requests — add a startup delay or readiness check.
  3. If using a domain/VIP, confirm serverListManager.isDomain() returns true so the domain path is used instead of the server-list path.
Defensive patterns

Strategy: retry

Validate before calling

// Ensure server list is populated before issuing naming requests
ServerListManager slm = ...; // from client internals
if (slm.getServerList().isEmpty() && !slm.isDomain()) {
    throw new IllegalStateException("No Nacos server available — check serverAddr config");
}

Try / catch

try {
    namingService.registerInstance(serviceName, instance);
} catch (NacosException e) {
    if (e.getErrCode() == NacosException.INVALID_PARAM
        && "no server available".equals(e.getErrMsg())) {
        // wait for server list to populate, then retry
        Thread.sleep(2000);
        namingService.registerInstance(serviceName, instance);
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: The ServerListManager has not yet retrieved any server addresses (or all were removed) and no domain/virtual-IP is configured. Any naming HTTP API call (register, query, etc.) will immediately fail.

Common situations: Startup race where the client sends a naming request before the server list has been fetched; misconfigured server address property (empty or unparseable); the Nacos server endpoint is unreachable during initial server-list discovery; the server list was cleared by a failed health-check sweep.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/88c4bd4398eef5c4. Report an issue: GitHub.

Appendix: source

Thrown at client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxy.java:385

    /**
     * Request api.
     *
     * @param api     api
     * @param params  parameters
     * @param body    body
     * @param servers servers
     * @param method  http method
     * @return result
     * @throws NacosException nacos exception
     */
    public String reqApi(String api, Map<String, String> params, Map<String, String> body,
        List<String> servers,
        String method) throws NacosException {
        
        params.put(CommonParams.NAMESPACE_ID, getNamespaceId());
        
        if (CollectionUtils.isEmpty(servers) && !serverListManager.isDomain()) {
            throw new NacosException(NacosException.INVALID_PARAM, "no server available");
        }
        
        NacosException exception = new NacosException();
        if (serverListManager.isDomain()) {
            String nacosDomain = serverListManager.getNacosDomain();
            for (int i = 0; i < maxRetry; i++) {
                try {
                    return callServer(api, params, body, nacosDomain, method);
                } catch (NacosException e) {
                    exception = e;
                    if (NAMING_LOGGER.isDebugEnabled()) {
                        NAMING_LOGGER.debug("request {} failed.", nacosDomain, e);
                    }
                }
            }
        } else {
            int index = ThreadLocalRandom.current().nextInt(servers.size());
            

View on GitHub (pinned to 9b989acdf1)