alibaba/nacos · critical · ConnectException

[NACOS HTTP-POST] The maximum number of tolerable server rec

Error message

[NACOS HTTP-POST] The maximum number of tolerable server reconnection errors has been reached

What it means

Thrown by ServerHttpAgent.httpPost when the retry budget is exhausted (maxRetry < 0) during a POST (config publish/remove). Identical control flow to the GET variant: each failing server decrements maxRetry once the iterator wraps, and once below zero the client stops. POSTs are typically config writes, so this surfaces during publish/delete operations against an unavailable cluster.

Source

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

                LOGGER.error("[NACOS ConnectException httpPost] currentServerAddr: {}, err : {}",
                    currentServerAddr,
                    connectException.getMessage());
            } catch (SocketTimeoutException socketTimeoutException) {
                LOGGER.error(
                    "[NACOS SocketTimeoutException httpPost] currentServerAddr: {}, err : {}",
                    currentServerAddr, socketTimeoutException.getMessage());
            } catch (Exception ex) {
                LOGGER.error("[NACOS Exception httpPost] currentServerAddr: " + currentServerAddr,
                    ex);
                throw ex;
            }
            
            if (serverListMgr.getIterator().hasNext()) {
                currentServerAddr = serverListMgr.getIterator().next();
            } else {
                maxRetry--;
                if (maxRetry < 0) {
                    throw new ConnectException(
                        "[NACOS HTTP-POST] The maximum number of tolerable server reconnection errors has been reached");
                }
                serverListMgr.refreshCurrentServerAddr();
            }
            
        } while (System.currentTimeMillis() <= endTime);
        
        LOGGER.error("no available server, currentServerAddr : {}", currentServerAddr);
        throw new ConnectException("no available server, currentServerAddr : " + currentServerAddr);
    }
    
    @Override
    public HttpRestResult<String> httpDelete(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;

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Verify all Nacos server nodes are up and the config endpoint accepts POSTs.
  2. Check for a reverse proxy/load balancer in front returning 5xx and bypass or fix it.
  3. Review client logs for the preceding per-server errors to identify the root transport failure.
  4. Raise maxRetry / readTimeout for write operations that need higher resilience.
Defensive patterns

Strategy: retry

Validate before calling

// before write, confirm at least one server is healthy
boolean anyHealthy = serverAddrs.stream().anyMatch(a -> ping(a));
if (!anyHealthy) throw new IllegalStateException("no healthy server for write");

Try / catch

try {
    configService.publishConfig(dataId, group, content);
} catch (Exception e) {
    if (e.getMessage().contains("HTTP-POST")) {
        // write failed across all servers — queue/retry with backoff, alert ops
        scheduleRetryWithBackoff();
    }
}

Prevention

When it happens

Trigger: Calling configService.publishConfig or removeConfig while every server returns a failure HTTP code or throws on the POST attempt, exhausting maxRetry before endTime.

Common situations: Cluster-wide outage during a config write, all nodes behind a gateway returning 502/503, or network partition blocking the POST path specifically.

Related errors


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