{"record":{"id":"10ebb635ff6134ff","repo":"alibaba/nacos","slug":"plugin-config-value-must-be-positive","errorCode":null,"errorMessage":"Plugin config value must be positive: ","messagePattern":"Plugin config value must be positive: ","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":187,"sourceCode":"            strictNonceValidation, strictAudienceValidation);\n    }\n    \n    private static String value(Map<String, String> config, String key, String defaultValue) {\n        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    }","sourceCodeStart":169,"sourceCodeEnd":205,"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#L169-L205","documentation":"Thrown by parsePositiveLong() when a numeric config value (jwks-cache-ttl-seconds or authorization-timeout-ms) parses but is zero or negative. Both must be strictly positive.","triggerScenarios":"Setting nacos.plugin.auth.oidc.jwks-cache-ttl-seconds=0 or authorization-timeout-ms to a negative number.","commonSituations":"Operator sets jwks-cache-ttl-seconds=0 intending to disable caching (the code does not support that); copy-paste of a negative value; misunderstanding that 0 is invalid.","solutions":["Set the value to a positive number of seconds (e.g. the default jwks-cache-ttl-seconds=3600, authorization-timeout-ms=5000).","To minimize caching, use a small positive value (e.g. 1) rather than 0.","The appended key name tells you which of the two settings is wrong."],"exampleFix":"// before\nnacos.plugin.auth.oidc.jwks-cache-ttl-seconds=0\n// after\nnacos.plugin.auth.oidc.jwks-cache-ttl-seconds=3600","handlingStrategy":"validation","validationCode":"// Validate positive-numeric config values before building the plugin config\nprivate static long requirePositive(String key, String raw) {\n    long v = Long.parseLong(raw);\n    if (v <= 0) throw new IllegalArgumentException(key + \" must be > 0, got \" + v);\n    return v;\n}","typeGuard":null,"tryCatchPattern":"try {\n    OidcAuthPluginConfig.from(configMap);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"must be positive\")) {\n        // reset the offending numeric key to its default and retry\n        log.warn(\"Resetting non-positive numeric OIDC config: {}\", e.getMessage());\n    }\n}","preventionTips":["Use the documented defaults (jwks-cache-ttl-seconds=3600, authorization-timeout-ms=5000) when unsure.","Never set these to 0; the code requires strictly positive values.","Validate numeric config in a pre-deployment config check."],"tags":["oidc","config","validation"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}