{"record":{"id":"ab7a9f1c7e5e8c1a","repo":"alibaba/nacos","slug":"plugin-config-value-is-not-a-number-ab7a9f","errorCode":null,"errorMessage":"Plugin config value is not a number: ","messagePattern":"Plugin config value is not a number: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"plugin-default-impl/nacos-oidc-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/oidc/config/OidcAuthPluginConfig.java","lineNumber":191,"sourceCode":"        if (config == null || !config.containsKey(key)) {\n            return defaultValue;\n        }\n        String result = config.get(key);\n        if (result == null) {\n            throw new IllegalArgumentException(\"Plugin config value cannot be null: \" + key);\n        }\n        return StringUtils.isBlank(result) ? defaultValue : result;\n    }\n    \n    private static long parsePositiveLong(String value, String key) {\n        try {\n            long result = Long.parseLong(value);\n            if (result <= 0) {\n                throw new IllegalArgumentException(\"Plugin config value must be positive: \" + key);\n            }\n            return result;\n        } catch (NumberFormatException e) {\n            throw new IllegalArgumentException(\"Plugin config value is not a number: \" + key, e);\n        }\n    }\n    \n    private static boolean parseBoolean(String value, String key) {\n        if (!Boolean.TRUE.toString().equalsIgnoreCase(value)\n            && !Boolean.FALSE.toString().equalsIgnoreCase(value)) {\n            throw new IllegalArgumentException(\"Plugin config value is not a boolean: \" + key);\n        }\n        return Boolean.parseBoolean(value);\n    }\n    \n    public boolean isValid() {\n        return StringUtils.isNotBlank(issuerUri) && StringUtils.isNotBlank(clientId);\n    }\n    \n    public boolean isJwtValidation() {\n        return DEFAULT_TOKEN_VALIDATION_METHOD.equalsIgnoreCase(tokenValidationMethod);\n    }","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/plugin-default-impl/nacos-oidc-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/oidc/config/OidcAuthPluginConfig.java#L173-L209","documentation":"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.","triggerScenarios":"Setting jwks-cache-ttl-seconds or authorization-timeout-ms to a non-numeric string (e.g. '1h', 'abc', 'five').","commonSituations":"Using time-unit suffixes like '1h' or '30m' (only raw digits are accepted); typo; stray whitespace/units in the value.","solutions":["Use a plain integer with no units (e.g. jwks-cache-ttl-seconds=3600).","Remove any surrounding quotes, spaces, or unit suffixes.","The appended key name identifies which setting is non-numeric."],"exampleFix":"// before\nnacos.plugin.auth.oidc.jwks-cache-ttl-seconds=1h\n// after\nnacos.plugin.auth.oidc.jwks-cache-ttl-seconds=3600","handlingStrategy":"validation","validationCode":"// Pre-validate that numeric config keys are parseable\nprivate static void assertNumeric(String key, String raw) {\n    try { Long.parseLong(raw); }\n    catch (NumberFormatException e) {\n        throw new IllegalArgumentException(key + \" must be a number, got: \" + raw);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    OidcAuthPluginConfig.from(configMap);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"is not a number\")) {\n        // log the offending key and prompt the operator for a corrected value\n        log.error(\"OIDC config parse error: {}\", e.getMessage());\n    }\n}","preventionTips":["Supply only raw digits for jwks-cache-ttl-seconds and authorization-timeout-ms.","Avoid time-unit suffixes ('h', 'm', 's') — they are not supported.","Add a config-validation step in deployment scripts."],"tags":["oidc","config","validation"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}