alibaba/nacos · error · IllegalArgumentException

[http-client] invalid connect timeout:{}

Error message

[http-client] invalid connect timeout:{}

What it means

Thrown by ParamUtil.initConnectionTimeout as an IllegalArgumentException when the connect-timeout configuration value cannot be parsed as an integer. The property key is MAINTAINER_CLIENT_CONNECT_TIMEOUT_KEY with a default of DEFAULT_CONNECT_TIMEOUT. A non-numeric value (e.g. 'abc', '10s') triggers NumberFormatException, which is logged then re-thrown.

Source

Thrown at maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/utils/ParamUtil.java:87

        
        maxRetryTimes = initMaxRetryTimes();
        LOGGER.info("[settings] [maintainer-http-client] max retry times:{}", maxRetryTimes);
        
        refreshIntervalMills = initRefreshIntervalMills();
        LOGGER.info("[settings] [maintainer-http-client] auth refresh interval mills:{}",
            refreshIntervalMills);
    }
    
    private static int initConnectionTimeout() {
        String connectTimeoutStr =
            NacosClientProperties.PROTOTYPE.getProperty(MAINTAINER_CLIENT_CONNECT_TIMEOUT_KEY,
                DEFAULT_CONNECT_TIMEOUT);
        try {
            return Integer.parseInt(connectTimeoutStr);
        } catch (NumberFormatException e) {
            final String msg = "[http-client] invalid connect timeout:" + connectTimeoutStr;
            LOGGER.error("[settings] {}", msg, e);
            throw new IllegalArgumentException(msg, e);
        }
    }
    
    private static int initReadTimeout() {
        String readTimeoutStr =
            NacosClientProperties.PROTOTYPE.getProperty(MAINTAINER_CLIENT_READ_TIMEOUT_KEY,
                DEFAULT_READ_TIMEOUT);
        try {
            return Integer.parseInt(readTimeoutStr);
        } catch (NumberFormatException e) {
            final String msg = "[http-client] invalid read timeout:" + readTimeoutStr;
            LOGGER.error("[settings] {}", msg, e);
            throw new IllegalArgumentException(msg, e);
        }
    }
    
    private static int initMaxRetryTimes() {
        String maxRetryTimesStr =

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Set MAINTAINER_CLIENT_CONNECT_TIMEOUT_KEY to a valid integer value in milliseconds (e.g. 1000).
  2. Remove the custom override to fall back to DEFAULT_CONNECT_TIMEOUT.
  3. Check all properties files, JVM -D flags, and environment variables for the connect-timeout key and correct any non-numeric values.

Example fix

# before
-Dnacos.maintainer.client.connect.timeout=10s

# after
-Dnacos.maintainer.client.connect.timeout=1000
Defensive patterns

Strategy: validation

Validate before calling

String raw = System.getProperty("nacos.maintainer.client.connect.timeout", "");
if (!raw.isEmpty()) {
    try { Integer.parseInt(raw); } catch (NumberFormatException e) {
    throw new IllegalArgumentException("connect.timeout must be a numeric millisecond value, got: " + raw);
    }
}

Prevention

When it happens

Trigger: Setting the system property or environment variable for MAINTAINER_CLIENT_CONNECT_TIMEOUT_KEY to a non-numeric string. The static initializer of ParamUtil runs at class load time, so this crashes during client initialization.

Common situations: Typo in a properties file (e.g. connect.timeout=10s instead of 1000). Passing a human-readable duration string where a raw integer (milliseconds) is expected. Copy-pasting a config snippet from documentation that used the wrong unit.

Understand the failure class

Related errors


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