{"record":{"id":"5bb49fff5e346f73","repo":"apache/cassandra","slug":"provided-kind-is-null","errorCode":null,"errorMessage":"Provided kind is null.","messagePattern":"Provided kind is null\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compression/CompressionDictionaryDetailsTabularData.java","lineNumber":298,"sourceCode":"         *     <li>dictLength has to be equal to dict's length</li>\n         *     <li>dictChecksum has to be equal to checksum computed as part of this method</li>\n         *     <li>creation date is not null</li>\n         * </ul>\n         */\n        private void validate()\n        {\n            if (keyspace == null)\n                throw new IllegalArgumentException(\"Keyspace not specified.\");\n            if (table == null)\n                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.\");","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compression/CompressionDictionaryDetailsTabularData.java#L280-L316","documentation":"The kind field of the dictionary descriptor must be a non-null string naming a compression dictionary algorithm. validate() rejects a null kind before attempting CompressionDictionary.Kind.valueOf(kind).","triggerScenarios":"Building a CompressionDictionaryDataObject without setting the kind (e.g. zstd) — the string field was never populated or the CompositeData lacked the KIND item.","commonSituations":"Import descriptors assembled from config where the algorithm option was omitted; serialization that dropped null fields; callers not realizing kind is mandatory alongside the raw bytes.","solutions":["Set the kind string to a valid CompressionDictionary.Kind name (e.g. \"ZSTD\") before validation","Read the kind from the existing dictionary metadata rather than leaving it unset","Check the JMX/CompositeData input includes a non-null KIND value"],"exampleFix":"// before\nString kind = null; // omitted in descriptor\n// after\nString kind = CompressionDictionary.Kind.ZSTD.name();","handlingStrategy":"validation","validationCode":"if (obj.kind == null) throw new IllegalArgumentException(\"kind must be set (e.g. \" + CompressionDictionary.Kind.ZSTD.name() + \")\");","typeGuard":"boolean hasKind(CompressionDictionaryDataObject o) { return o.kind != null; }","tryCatchPattern":"try { tabularData.fromDataObject(obj); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Provided kind is null\")) { /* set kind from known metadata and rebuild */ } else throw e; }","preventionTips":["Set kind alongside the payload in a single constructor call so it cannot be forgotten","Derive kind from the dictionary file's metadata instead of user input","Validate the descriptor with a shared pre-check helper before any import"],"tags":["validation","compression-dictionary"],"backgroundTag":"null-argument","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"}