apache/cassandra · error · IllegalStateException

Use 'true' or 'false' values for booleans

Error message

Use 'true' or 'false' values for booleans

What it means

When coercing a command-line argument to a boolean parameter, the guardrails-config set command accepts only the literal strings 'true' or 'false'; any other spelling throws IllegalStateException 'Use 'true' or 'false' values for booleans'.

Solutions

  1. Use exactly lowercase `true` or `false` for boolean guardrail values.
  2. Remove surrounding quotes/case transformations in scripts.
  3. Check the setter's parameter type to know whether the value must be boolean.

Example fix

// before
nodetool guardrailsconfig set some_boolean_guardrail yes
// after
nodetool guardrailsconfig set some_boolean_guardrail true
Defensive patterns

Strategy: validation

Validate before calling

def validate_bool(v):
    if v not in ('true','false'):
        raise SystemExit("booleans must be exactly 'true' or 'false'")
    return v

Prevention

When it happens

Trigger: Running `nodetool guardrailsconfig set <boolean_guardrail> yes` (or 1, True, FALSE) — any value other than lowercase 'true'/'false' for a boolean-typed setter parameter.

Common situations: Using shell-style 'yes/no' or '1/0'; capitalizing 'True' as in Python; quoting issues in scripts altering the value.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/5559c0cd05066715. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/tools/nodetool/GuardrailsConfigCommand.java:320

                arguments = thresholdArgs.toArray();
            }

            return arguments;
        }

        private Object castType(Class<?> targetType, String value) throws IllegalArgumentException
        {
            if (targetType == String.class)
                return value.equals("null") ? "" : value;
            else if (targetType == int.class || targetType == Integer.class)
                return getNumber(value, Integer::parseInt, -1);
            else if (targetType == long.class || targetType == Long.class)
                return getNumber(value, Long::parseLong, -1);
            else if (targetType == boolean.class || targetType == Boolean.class)
            {
                return getNumber(value, (v) -> {
                    if (!v.equals("true") && !v.equals("false"))
                        throw new IllegalStateException("Use 'true' or 'false' values for booleans");

                    return Boolean.parseBoolean(v);
                }, false);
            }
            else if (targetType == Set.class)
            {
                if (value == null || value.equals("null") || value.equals("[]"))
                    return new HashSet<>();
                else
                    return new LinkedHashSet<>(Arrays.asList(value.split(",")));
            }
            else
            {
                throw new IllegalArgumentException(format("unsupported type: %s", targetType));
            }
        }

        private <T> T getNumber(String value, Function<String, T> transformer, T defaultValue)

View on GitHub (pinned to 88fd0f6a0e)