alibaba/nacos · critical · ConnectException

no available server

Error message

no available server

What it means

Thrown by ServerHttpAgent.httpGet when the do-while retry loop exits because the current time exceeded endTime (now > start + readTimeoutMs) before maxRetry ran out, and no server returned a success response. Unlike the max-retry variant, the budget was still available but the time window elapsed — the client was still attempting servers when the deadline hit.

Source

Thrown at client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java:117

                    ex);
                throw ex;
            }
            
            if (serverListMgr.getIterator().hasNext()) {
                currentServerAddr = serverListMgr.getIterator().next();
            } else {
                maxRetry--;
                if (maxRetry < 0) {
                    throw new ConnectException(
                        "[NACOS HTTP-GET] The maximum number of tolerable server reconnection errors has been reached");
                }
                serverListMgr.refreshCurrentServerAddr();
            }
            
        } while (System.currentTimeMillis() <= endTime);
        
        LOGGER.error("no available server");
        throw new ConnectException("no available server");
    }
    
    @Override
    public HttpRestResult<String> httpPost(String path, Map<String, String> headers,
        Map<String, String> paramValues,
        String encode, long readTimeoutMs) throws Exception {
        final long endTime = System.currentTimeMillis() + readTimeoutMs;
        String currentServerAddr = serverListMgr.getCurrentServer();
        int maxRetry = this.maxRetry;
        HttpClientConfig httpConfig = HttpClientConfig.builder()
            .setReadTimeOutMillis(Long.valueOf(readTimeoutMs).intValue())
            .setConTimeOutMillis(
                ConfigHttpClientManager.getInstance().getConnectTimeoutOrDefault(3000))
            .build();
        do {
            try {
                Header newHeaders = Header.newInstance();
                if (headers != null) {

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Increase readTimeoutMs on the config client (e.g. PropertyKeyConst.CONFIG_LONG_POLL_TIMEOUT or the readTimeoutMs param).
  2. Diagnose network latency between client and server (ping, traceroute) and resolve the slow path.
  3. Confirm server load/CPU is not saturating response times.
  4. If using a small timeout intentionally, ensure the server list is small and fast to fail.
Defensive patterns

Strategy: retry

Validate before calling

long readTimeoutMs = 10_000; // ensure > expected per-request latency * server count
// pass readTimeoutMs when constructing the client / calling the API

Try / catch

try {
    configService.getConfig(dataId, group, readTimeoutMs);
} catch (Exception e) {
    if (e.getMessage().contains("no available server")) {
        log.error("read window expired before any server responded");
    }
    throw e;
}

Prevention

When it happens

Trigger: Each server attempt consumes enough wall-clock (slow connects, read timeouts near the per-request limit) that endTime passes before retries are exhausted; the loop condition (System.currentTimeMillis() <= endTime) becomes false.

Common situations: A very short readTimeoutMs combined with slow/unresponsive servers, network latency spikes, or DNS resolution delays consuming the whole window on a single attempt.

Related errors


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