{"record":{"id":"6d54997c44ca3cbc","repo":"apache/cassandra","slug":"unknown-clazz-getname-input","errorCode":null,"errorMessage":"Unknown \" + clazz.getName() + \": '\" + input + \"'","messagePattern":"Unknown \" \\+ clazz\\.getName\\(\\) \\+ \": '\" \\+ input \\+ \"'","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/virtual/AccordDebugKeyspace.java","lineNumber":2536,"sourceCode":"    }\n\n    private static AccordTracing tracing()\n    {\n        return ((AccordAgent)AccordService.unsafeInstance().agent()).tracing();\n    }\n\n    private static <E extends Enum<E>> E tryParse(Object input, boolean toUpperCase, Class<E> clazz, Function<String, E> valueOf)\n    {\n        try\n        {\n            String str = (String) input;\n            if (toUpperCase)\n                str = LocalizeString.toUpperCaseLocalized(str, Locale.ENGLISH);\n            return valueOf.apply(str);\n        }\n        catch (IllegalArgumentException | NullPointerException e)\n        {\n            throw new InvalidRequestException(\"Unknown \" + clazz.getName() + \": '\" + input + '\\'');\n        }\n    }\n\n    private static CoordinationKinds tryParseCoordinationKinds(Object input)\n    {\n        if (input == null)\n            return null;\n\n        return CoordinationKinds.parse((String) input);\n    }\n\n    private static TxnKindsAndDomains tryParseTxnKinds(Object input)\n    {\n        if (input == null)\n            return null;\n\n        return TxnKindsAndDomains.parse((String) input);\n    }","sourceCodeStart":2518,"sourceCodeEnd":2554,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/virtual/AccordDebugKeyspace.java#L2518-L2554","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["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","Check the enum's constants for your Cassandra version (javap or source) rather than trusting external docs","Remove stray quotes/whitespace from the value"],"exampleFix":"// before\nUPDATE system.accord_debug SET coordination_kind = 'range_read';\n// after\nUPDATE system.accord_debug SET coordination_kind = 'RangeRead'; // must match a constant of the class named in the error","handlingStrategy":"validation","validationCode":"// validate against the exact enum class named in the error before writing\nboolean valid = value != null && java.util.Arrays.stream(TheEnum.values())\n    .anyMatch(c -> c.name().equalsIgnoreCase(value.trim()));","typeGuard":"boolean isValidEnumName(Class<? extends Enum<?>> type, Object v) {\n    return v instanceof String s && java.util.Arrays.stream(type.getEnumConstants())\n        .anyMatch(c -> c.name().equalsIgnoreCase(s.trim()));\n}","tryCatchPattern":"try {\n    session.execute(update);\n} catch (InvalidRequestException e) {\n    if (e.getMessage().startsWith(\"Unknown \")) {\n        // message names the expected class; pick a valid constant and retry\n    }\n}","preventionTips":["Parse the class name out of the error message and enumerate its constants","Keep enum-name lists version-pinned; verify after upgrading Cassandra","Trim and uppercase values before sending to match the helper's normalization"],"tags":["cassandra","cql","enum","parsing"],"backgroundTag":"invalid-enum-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}