{"record":{"id":"44c94b52ad9bc5b4","repo":"alibaba/nacos","slug":"plugin-config-value-cannot-be-null-44c94b","errorCode":null,"errorMessage":"Plugin config value cannot be null: ","messagePattern":"Plugin config value cannot be null: ","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":178,"sourceCode":"            AUTHORIZATION_TIMEOUT_MS);\n        boolean strictNonceValidation = parseBoolean(value(config, STRICT_NONCE_VALIDATION,\n            Boolean.toString(DEFAULT_STRICT_NONCE_VALIDATION)), STRICT_NONCE_VALIDATION);\n        boolean strictAudienceValidation = parseBoolean(value(config,\n            STRICT_AUDIENCE_VALIDATION, Boolean.toString(DEFAULT_STRICT_AUDIENCE_VALIDATION)),\n            STRICT_AUDIENCE_VALIDATION);\n        return new OidcAuthPluginConfig(issuerUri, clientId, clientSecret, scope,\n            tokenValidationMethod, jwksCacheTtlSeconds, usernameClaim, rolesClaim, adminRole,\n            autoCreateUser, authorizationEndpoint, authorizationTimeoutMs,\n            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)","sourceCodeStart":160,"sourceCodeEnd":196,"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#L160-L196","documentation":"Thrown by OidcAuthPluginConfig.value() when the config map explicitly contains a key but its value is null. This is distinct from a missing key (which falls back to the default). It signals a malformed config entry: the operator named the key but supplied null.","triggerScenarios":"The plugin config map has an entry like {\"client-secret\": null} — the key is present with a null value. This typically happens when a config source maps an unset property to null rather than omitting it.","commonSituations":"A YAML/properties file with an empty value deserialized to null; a UI that writes the key with null when the field is cleared; programmatic config builders that put(key, null).","solutions":["Remove the offending key from the config so the default applies, or give it an explicit non-null string value.","If building the map programmatically, filter out null values before passing to OidcAuthPluginConfig.from().","The appended key name in the message identifies exactly which entry is null."],"exampleFix":"// before: config map contains a null value\nMap<String,String> cfg = new HashMap<>();\ncfg.put(\"client-secret\", null);\nOidcAuthPluginConfig.from(cfg); // throws\n// after: omit the key or supply a value\nMap<String,String> cfg = new HashMap<>();\n// client-secret omitted -> defaults to \"\"\nOidcAuthPluginConfig.from(cfg);","handlingStrategy":"validation","validationCode":"// Sanitize the config map before parsing: drop null-valued entries\nMap<String, String> clean = new LinkedHashMap<>();\nfor (Map.Entry<String, String> e : rawConfig.entrySet()) {\n    if (e.getValue() != null) {\n        clean.put(e.getKey(), e.getValue());\n    }\n}\nOidcAuthPluginConfig.from(clean);","typeGuard":null,"tryCatchPattern":"try {\n    OidcAuthPluginConfig.from(configMap);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Plugin config value cannot be null: \")) {\n        String key = e.getMessage().substring(\"Plugin config value cannot be null: \".length());\n        configMap.remove(key); // let the default apply\n    } else {\n        throw e;\n    }\n}","preventionTips":["Filter null values out of config maps before passing them to OidcAuthPluginConfig.from().","In config UIs, treat cleared fields as absent rather than null.","The appended key name pinpoints the offending entry — read it from the message."],"tags":["oidc","config","validation"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}