{"record":{"id":"76601fac0febf47e","repo":"alibaba/nacos","slug":"plugin-config-value-is-not-a-number-key-76601f","errorCode":null,"errorMessage":"Plugin config value is not a number: {key}","messagePattern":"Plugin config value is not a number: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"plugin-default-impl/nacos-ldap-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/ldap/LdapAuthPluginConfig.java","lineNumber":145,"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 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 String getUrl() {\n        return url;\n    }\n    \n    public String getBaseDn() {\n        return baseDn;\n    }","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/plugin-default-impl/nacos-ldap-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/ldap/LdapAuthPluginConfig.java#L127-L163","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nnacos.plugin.auth.ldap.timeout=3s\n\n# after\nnacos.plugin.auth.ldap.timeout=3000","handlingStrategy":"validation","validationCode":"String timeoutStr = config.getOrDefault(\"timeout\", \"3000\");\nif (!timeoutStr.matches(\"^\\\\d+$\")) {\n    throw new IllegalArgumentException(\"timeout must be a plain integer\");\n}","typeGuard":"static boolean isPlainNumeric(String value) {\n    return value != null && value.matches(\"^\\\\d+$\");\n}","tryCatchPattern":"try {\n    LdapAuthPluginConfig parsed = LdapAuthPluginConfig.from(config);\n} catch (IllegalArgumentException e) {\n    // if message contains 'not a number', fix the timeout to a plain integer\n}","preventionTips":["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."],"tags":["auth","ldap","config","validation","timeout","number-format","illegal-argument","java"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}