apache/cassandra · error · IllegalArgumentException

unsupported type: %s

Error message

unsupported type: %s

What it means

nodetool GuardrailsConfigCommand casts a user-supplied string option into a Java collection type (Set/HashSet/LinkedHashSet) when preparing arguments for the guardrails config call. If the option's declared targetType is not one of the supported collection/string types, castType throws IllegalArgumentException with the unsupported type name. It is a developer/CLI-metdata bug, not a user input problem: the type must come from the command's own parameter definitions.

Source

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

            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)
        {
            if (value == null || value.equals("null"))
                return defaultValue;

            try
            {
                return transformer.apply(value);
            }
            catch (NumberFormatException ex)
            {
                throw new IllegalStateException(format("Unable to parse value %s", value), ex);
            }
        }
    }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Change the guardrail option's declared type to a supported one (String or Set, comma-separated values)
  2. Add a castType branch for the missing targetType so it is converted explicitly
  3. Downgrade/upgrade so nodetool and the server use matching versions of the tooling
  4. Run the command without the offending option and set the guardrail via cassandra.yaml or JMX instead

Example fix

// before
castListArg(options, "disallowed-compare-operators", List.class);
// after
// use a supported type
castSetArg(options, "disallowed-compare-operators", Set.class);
Defensive patterns

Strategy: validation

Validate before calling

// before invoking nodetool guardrails-config, ensure the option value is a supported type (string or comma-separated set)
if (!List.of("String","Set").contains(optionType))
    throw new IllegalArgumentException("Option type not supported by castType: " + optionType);

Type guard

if (value instanceof String || value instanceof java.util.Set) { /* proceed */ }

Try / catch

try { runNodetool("guardrails-config", args); } catch (IllegalArgumentException e) { log("Unsupported guardrail type: " + e.getMessage()); }

Prevention

When it happens

Trigger: Running `nodetool guardrails-config` set/get paths where an option's configured type is anything other than the supported Set types or String, e.g. a new guardrail parameter added with List or Map type that castType was never extended to handle.

Common situations: Extending GuardrailsConfigCommand with a new guardrail property whose value type is not a comma-separated set; copy-pasting a parameter definition with the wrong type; version drift between nodetool client and server guardrail configuration.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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