alibaba/nacos · error · IllegalArgumentException

Plugin config value is not a boolean: {key}

Error message

Plugin config value is not a boolean: {key}

What it means

Thrown by LdapAuthPluginConfig.parseBoolean() when the case-sensitive or ignore-partial-result-exception config value is not a recognized boolean literal. The parser only accepts "true" or "false" (case-insensitive); anything else is rejected with IllegalArgumentException naming the offending key.

Source

Thrown at plugin-default-impl/nacos-ldap-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/ldap/LdapAuthPluginConfig.java:152

        return 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 String getUrl() {
        return url;
    }
    
    public String getBaseDn() {
        return baseDn;
    }
    
    public long getTimeout() {
        return timeout;
    }
    
    public String getUserDn() {
        return userDn;

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Use exactly "true" or "false" (case-insensitive) for case-sensitive and ignore-partial-result-exception.
  2. Omit the key to accept the documented defaults (case-sensitive=true, ignore-partial-result-exception=false).
  3. Audit the config file for any non-standard boolean spellings.

Example fix

# before
nacos.plugin.auth.ldap.case-sensitive=yes

# after
nacos.plugin.auth.ldap.case-sensitive=true
Defensive patterns

Strategy: validation

Validate before calling

String value = config.getOrDefault("case-sensitive", "true");
if (!value.equalsIgnoreCase("true") && !value.equalsIgnoreCase("false")) {
    throw new IllegalArgumentException("must be 'true' or 'false'");
}

Type guard

static boolean isBooleanLiteral(String value) {
    return value != null
        && (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false"));
}

Try / catch

try {
    LdapAuthPluginConfig parsed = LdapAuthPluginConfig.from(config);
} catch (IllegalArgumentException e) {
    // if message contains 'not a boolean', use exactly true/false
}

Prevention

When it happens

Trigger: LdapAuthPluginConfig.from() parses case-sensitive or ignore-partial-result-exception; the value is something like "yes", "1", "on", or "True"-variant-not-matching. Since the check uses Boolean.TRUE.toString()/Boolean.FALSE.toString() with equalsIgnoreCase, only "true"/"false" pass.

Common situations: Operator uses a common-but-unsupported boolean spelling ("yes", "1", "on", "enabled"); a config template from another tool uses non-standard boolean values.

Related errors


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