alibaba/nacos · error · IllegalArgumentException
[http-client] invalid max retry times:{}
Error message
[http-client] invalid max retry times:{} What it means
Thrown by ParamUtil.initMaxRetryTimes as an IllegalArgumentException when the max-retry configuration value cannot be parsed as an integer. The property key is MAINTAINER_CLIENT_MAX_RETRY_TIMES_KEY, defaulting to DEFAULT_MAX_RETRY_TIMES. Runs at class-load time.
Source
Thrown at maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/utils/ParamUtil.java:113
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 =
NacosClientProperties.PROTOTYPE.getProperty(MAINTAINER_CLIENT_MAX_RETRY_TIMES_KEY,
String.valueOf(DEFAULT_MAX_RETRY_TIMES));
try {
return Integer.parseInt(maxRetryTimesStr);
} catch (NumberFormatException e) {
final String msg = "[http-client] invalid max retry times:" + maxRetryTimesStr;
LOGGER.error("[settings] {}", msg, e);
throw new IllegalArgumentException(msg, e);
}
}
private static long initRefreshIntervalMills() {
String refreshIntervalMillsStr = NacosClientProperties.PROTOTYPE.getProperty(
MAINTAINER_CLIENT_REFRESH_INTERVAL_MILLS_KEY,
String.valueOf(DEFAULT_REFRESH_INTERVAL_MILLS));
try {
return Long.parseLong(refreshIntervalMillsStr);
} catch (NumberFormatException e) {
final String msg =
"[http-client] invalid auth refresh interval:" + refreshIntervalMillsStr;
LOGGER.error("[settings] {}", msg, e);
throw new IllegalArgumentException(msg, e);
}
}
public static int getConnectTimeout() {View on GitHub (pinned to 9b989acdf1)
Solutions
- Set MAINTAINER_CLIENT_MAX_RETRY_TIMES_KEY to a valid integer (e.g. 3).
- Remove the override to fall back to the default retry count.
- Audit all configuration sources for non-numeric values in the retry-times property.
Example fix
# before -Dnacos.maintainer.client.max.retry.times=5x # after -Dnacos.maintainer.client.max.retry.times=5
Defensive patterns
Strategy: validation
Validate before calling
String raw = System.getProperty("nacos.maintainer.client.max.retry.times", "");
if (!raw.isEmpty()) {
try { Integer.parseInt(raw); } catch (NumberFormatException e) {
throw new IllegalArgumentException("max.retry.times must be numeric, got: " + raw);
}
} Prevention
- Specify retry count as a plain integer with no suffix or multiplier.
- Validate numeric config properties at bootstrap before the client initializes.
- Use the documented default if you do not need a custom retry count.
When it happens
Trigger: Setting the system property or environment variable for MAINTAINER_CLIENT_MAX_RETRY_TIMES_KEY to a non-numeric value. NumberFormatException triggers the logged IllegalArgumentException.
Common situations: Properties file or JVM argument contains a non-numeric retry count (e.g. 'three', '5x'). Templated config with an unresolved variable placeholder. Copy-paste error from documentation.
Related errors
- [http-client] invalid connect timeout:{}
- [http-client] invalid read timeout:{}
- [http-client] invalid auth refresh interval:{}
- 400
- No available server after {} retries, last tried server: {},
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/720e5542fcc22a92.
Report an issue: GitHub.