alibaba/nacos · error · IllegalArgumentException
Plugin config value is not a number
Error message
Plugin config value is not a number: {key} What it means
Thrown by LdapAuthPluginConfig.parsePositiveLong() when the timeout value cannot be parsed as a long at all (NumberFormatException). The original exception is chained as the cause. The error message names the 'timeout' key so the operator knows which value is malformed.
Solutions
- Set the timeout to a plain integer in milliseconds (e.g. 3000), no units or separators.
- If the value comes from an environment variable, ensure it is a clean numeric string.
- Validate the timeout string with a regex like ^\d+$ before passing it into the config.
Example fix
# before nacos.plugin.auth.ldap.timeout=3s # after nacos.plugin.auth.ldap.timeout=3000
Defensive patterns
Strategy: validation
Validate before calling
String timeoutStr = config.getOrDefault("timeout", "3000");
if (!timeoutStr.matches("^\\d+$")) {
throw new IllegalArgumentException("timeout must be a plain integer");
} Type guard
static boolean isPlainNumeric(String value) {
return value != null && value.matches("^\\d+$");
} Try / catch
try {
LdapAuthPluginConfig parsed = LdapAuthPluginConfig.from(config);
} catch (IllegalArgumentException e) {
// if message contains 'not a number', fix the timeout to a plain integer
} Prevention
- Use a bare integer (e.g. 3000) for timeout; no units, commas, or suffixes.
- Validate numeric config values with a regex before parsing.
- Document accepted config formats for operators.
When it happens
Trigger: LdapAuthPluginConfig.from() calls parsePositiveLong for the timeout key, but the value is a non-numeric string (e.g. "3s", "abc", "3,000"). Long.parseLong throws NumberFormatException, caught and rethrown as IllegalArgumentException.
Common situations: Operator enters a human-readable duration like "3s" or "3000ms" instead of a bare number; a locale-specific number format (comma thousands separator) is used; a stray character is pasted into the value.
Related errors
- Plugin config value must be positive
- Plugin config value cannot be null
- Plugin config value is not a boolean
- LDAP auth plugin requires…
- LDAP login failed.
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/76601fac0febf47e.
Report an issue: GitHub.
Appendix: source
Thrown at plugin-default-impl/nacos-ldap-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/ldap/LdapAuthPluginConfig.java:145
if (config == null || !config.containsKey(key)) {
return defaultValue;
}
String result = config.get(key);
if (result == null) {
throw new IllegalArgumentException("Plugin config value cannot be null: " + key);
}
return result;
}
private static long parsePositiveLong(String value, String key) {
try {
long result = Long.parseLong(value);
if (result <= 0) {
throw new IllegalArgumentException("Plugin config value must be positive: " + key);
}
return result;
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Plugin config value is not a number: " + key, e);
}
}
private static boolean parseBoolean(String value, String key) {
if (!Boolean.TRUE.toString().equalsIgnoreCase(value)
&& !Boolean.FALSE.toString().equalsIgnoreCase(value)) {
throw new IllegalArgumentException("Plugin config value is not a boolean: " + key);
}
return Boolean.parseBoolean(value);
}
public String getUrl() {
return url;
}
public String getBaseDn() {
return baseDn;
}View on GitHub (pinned to 9b989acdf1)