alibaba/nacos · error · IllegalArgumentException

Plugin config value is not a number:

Error message

Plugin config value is not a number: 

What it means

Thrown by parsePositiveLong() when Long.parseLong fails on a config value that must be a number (jwks-cache-ttl-seconds or authorization-timeout-ms). The NumberFormatException is wrapped and its key appended.

Source

Thrown at plugin-default-impl/nacos-oidc-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/oidc/config/OidcAuthPluginConfig.java:191

        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 StringUtils.isBlank(result) ? defaultValue : 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 boolean isValid() {
        return StringUtils.isNotBlank(issuerUri) && StringUtils.isNotBlank(clientId);
    }
    
    public boolean isJwtValidation() {
        return DEFAULT_TOKEN_VALIDATION_METHOD.equalsIgnoreCase(tokenValidationMethod);
    }

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Use a plain integer with no units (e.g. jwks-cache-ttl-seconds=3600).
  2. Remove any surrounding quotes, spaces, or unit suffixes.
  3. The appended key name identifies which setting is non-numeric.

Example fix

// before
nacos.plugin.auth.oidc.jwks-cache-ttl-seconds=1h
// after
nacos.plugin.auth.oidc.jwks-cache-ttl-seconds=3600
Defensive patterns

Strategy: validation

Validate before calling

// Pre-validate that numeric config keys are parseable
private static void assertNumeric(String key, String raw) {
    try { Long.parseLong(raw); }
    catch (NumberFormatException e) {
        throw new IllegalArgumentException(key + " must be a number, got: " + raw);
    }
}

Try / catch

try {
    OidcAuthPluginConfig.from(configMap);
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("is not a number")) {
        // log the offending key and prompt the operator for a corrected value
        log.error("OIDC config parse error: {}", e.getMessage());
    }
}

Prevention

When it happens

Trigger: Setting jwks-cache-ttl-seconds or authorization-timeout-ms to a non-numeric string (e.g. '1h', 'abc', 'five').

Common situations: Using time-unit suffixes like '1h' or '30m' (only raw digits are accepted); typo; stray whitespace/units in the value.

Related errors


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