apache/cassandra · error · InvalidRequestException

Unknown " + clazz.getName() + ": '" + input + "'

Error message

Unknown " + clazz.getName() + ": '" + input + "'

What it means

The generic parse helper in AccordDebugKeyspace converts a user-supplied string to an enum (or similar type) via a valueOf function, optionally uppercasing first. IllegalArgumentException or NullPointerException from that conversion is rethrown as an InvalidRequestException that names the Java class and the offending input, so the caller knows exactly which value failed to map.

Source

Thrown at src/java/org/apache/cassandra/db/virtual/AccordDebugKeyspace.java:2536

    }

    private static AccordTracing tracing()
    {
        return ((AccordAgent)AccordService.unsafeInstance().agent()).tracing();
    }

    private static <E extends Enum<E>> E tryParse(Object input, boolean toUpperCase, Class<E> clazz, Function<String, E> valueOf)
    {
        try
        {
            String str = (String) input;
            if (toUpperCase)
                str = LocalizeString.toUpperCaseLocalized(str, Locale.ENGLISH);
            return valueOf.apply(str);
        }
        catch (IllegalArgumentException | NullPointerException e)
        {
            throw new InvalidRequestException("Unknown " + clazz.getName() + ": '" + input + '\'');
        }
    }

    private static CoordinationKinds tryParseCoordinationKinds(Object input)
    {
        if (input == null)
            return null;

        return CoordinationKinds.parse((String) input);
    }

    private static TxnKindsAndDomains tryParseTxnKinds(Object input)
    {
        if (input == null)
            return null;

        return TxnKindsAndDomains.parse((String) input);
    }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Use exactly one of the target enum's constant names (case-insensitive if the helper uppercases) — the class name in the message tells you which enum
  2. Check the enum's constants for your Cassandra version (javap or source) rather than trusting external docs
  3. Remove stray quotes/whitespace from the value

Example fix

// before
UPDATE system.accord_debug SET coordination_kind = 'range_read';
// after
UPDATE system.accord_debug SET coordination_kind = 'RangeRead'; // must match a constant of the class named in the error
Defensive patterns

Strategy: validation

Validate before calling

// validate against the exact enum class named in the error before writing
boolean valid = value != null && java.util.Arrays.stream(TheEnum.values())
    .anyMatch(c -> c.name().equalsIgnoreCase(value.trim()));

Type guard

boolean isValidEnumName(Class<? extends Enum<?>> type, Object v) {
    return v instanceof String s && java.util.Arrays.stream(type.getEnumConstants())
        .anyMatch(c -> c.name().equalsIgnoreCase(s.trim()));
}

Try / catch

try {
    session.execute(update);
} catch (InvalidRequestException e) {
    if (e.getMessage().startsWith("Unknown ")) {
        // message names the expected class; pick a valid constant and retry
    }
}

Prevention

When it happens

Trigger: Setting a string column on an Accord debug virtual table that is parsed into an enum type (e.g. a coordination kind, mode, or status field) with a name that does not match any constant of that enum, or passing null.

Common situations: Typos in enum names in cqlsh sessions; version drift where the enum constant was added/renamed so older docs no longer match; pasting values with quotes/whitespace; using lowercase where the value must be uppercase (though the helper usually uppercases).

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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