{"record":{"id":"a639cac6118327d5","repo":"apache/cassandra","slug":"there-is-no-such-dictionary-kind-like-kind-av","errorCode":null,"errorMessage":"There is no such dictionary kind like '<kind>'. Available kinds: <kinds>.","messagePattern":"There is no such dictionary kind like '<kind>'\\. Available kinds: <kinds>\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compression/CompressionDictionaryDetailsTabularData.java","lineNumber":308,"sourceCode":"                throw new IllegalArgumentException(\"Table not specified.\");\n            if (tableId == null)\n                throw new IllegalArgumentException(\"Table id not specified.\");\n            if (dictId <= 0)\n                throw new IllegalArgumentException(\"Provided dictionary id must be positive but it is '\" + dictId + \"'.\");\n            if (dict == null || dict.length == 0)\n                throw new IllegalArgumentException(\"Provided dictionary byte array is null or empty.\");\n            if (kind == null)\n                throw new IllegalArgumentException(\"Provided kind is null.\");\n\n            CompressionDictionary.Kind dictionaryKind;\n\n            try\n            {\n                dictionaryKind = CompressionDictionary.Kind.valueOf(kind);\n            }\n            catch (IllegalArgumentException ex)\n            {\n                throw new IllegalArgumentException(\"There is no such dictionary kind like '\" + kind + \"'. Available kinds: \" + Arrays.asList(CompressionDictionary.Kind.values()));\n            }\n\n            if (dictLength <= 0)\n                throw new IllegalArgumentException(\"Size has to be strictly positive number, it is '\" + dictLength + \"'.\");\n            if (dict.length != dictLength)\n                throw new IllegalArgumentException(\"The length of the provided dictionary array (\" + dict.length + \") is not equal to provided length value (\" + dictLength + \").\");\n            if (createdAt == null)\n                throw new IllegalArgumentException(\"The creation date not specified.\");\n\n            int checksumOfDictionaryToImport = CompressionDictionary.calculateChecksum((byte) dictionaryKind.ordinal(), dictId, dict);\n            if (checksumOfDictionaryToImport != dictChecksum)\n            {\n                throw new IllegalArgumentException(format(\"Computed checksum of dictionary to import (%s) is different from checksum specified on input (%s).\",\n                                                          checksumOfDictionaryToImport,\n                                                          dictChecksum));\n            }\n        }\n    }","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compression/CompressionDictionaryDetailsTabularData.java#L290-L326","documentation":"The kind string must exactly match one of the CompressionDictionary.Kind enum constants. When Kind.valueOf(kind) throws, validate() re-throws with the supplied value and the list of available kinds. This guards against typo'd or unsupported algorithm names on imported dictionaries.","triggerScenarios":"Calling import/registration with kind = \"zstd\" (wrong case), \"lz4\", or any string not in CompressionDictionary.Kind.values(); Kind.valueOf is case-sensitive, so case mismatches trigger this even for the right algorithm.","commonSituations":"Lower-cased algorithm names from config files or CLI flags; names from older/newer versions whose enum constants differ; hand-typed JMX imports.","solutions":["Use the exact enum constant name, e.g. CompressionDictionary.Kind.ZSTD.name(), not a lower-case string","Match the case exactly (valueOf is case-sensitive)","Print CompressionDictionary.Kind.values() (already in the message) and pick one of the listed kinds","If the algorithm is genuinely unsupported, use one of the available kinds or upgrade Cassandra"],"exampleFix":"// before\nString kind = \"zstd\"; // wrong case\n// after\nString kind = CompressionDictionary.Kind.ZSTD.name(); // exact enum name","handlingStrategy":"validation","validationCode":"boolean validKind = Arrays.stream(CompressionDictionary.Kind.values()).anyMatch(k -> k.name().equals(obj.kind));\nif (!validKind) throw new IllegalArgumentException(\"Unknown kind: \" + obj.kind);","typeGuard":"boolean isKnownKind(String s) { return s != null && Arrays.stream(CompressionDictionary.Kind.values()).anyMatch(k -> k.name().equals(s)); }","tryCatchPattern":"try { tabularData.fromDataObject(obj); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"no such dictionary kind\")) { /* normalize kind to enum name() and rebuild */ } else throw e; }","preventionTips":["Always build kind strings via CompressionDictionary.Kind.X.name() rather than literals","Remember valueOf is case-sensitive — uppercase names like ZSTD","Validate the kind against the enum before constructing the data object"],"tags":["validation","enum","compression-dictionary"],"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"}