{"record":{"id":"825492ba179cfa51","repo":"apache/cassandra","slug":"keyspace-not-specified","errorCode":null,"errorMessage":"Keyspace not specified.","messagePattern":"Keyspace not specified\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compression/CompressionDictionaryDetailsTabularData.java","lineNumber":288,"sourceCode":"        /**\n         * An object of this class is considered to be valid if:\n         *\n         * <ul>\n         *     <li>keyspace, table and table id are not null</li>\n         *     <li>dict id is lower than 0</li>\n         *     <li>dict is not null nor empty</li>\n         *     <li>dict length is less than or equal to 1MiB</li>\n         *     <li>kind is not null and there is such {@link org.apache.cassandra.db.compression.CompressionDictionary.Kind}</li>\n         *     <li>dictLength is bigger than 0</li>\n         *     <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)","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compression/CompressionDictionaryDetailsTabularData.java#L270-L306","documentation":"CompressionDictionaryDetailsTabularData validates every field of an imported compression dictionary before converting it to a CompositeData/JMX representation. This error means the keyspace field of the CompressionDictionaryDataObject was null when validate() ran. The library throws it eagerly so an incomplete dictionary descriptor never reaches the compression dictionary management path.","triggerScenarios":"Constructing a CompressionDictionaryDataObject (or publishing its TabularData via CompressionDictionaryDetailsTabularData) with keyspace == null — e.g. the caller omitted keyspace when importing a dictionary or built the object programmatically without setting it.","commonSituations":"Hand-written import code or scripts that build the dictionary descriptor and forget the keyspace field; deserializing a partially-populated JMX CompositeData where the keyspace key is absent.","solutions":["Set a valid keyspace name on the CompressionDictionaryDataObject before it is validated","If building from CompositeData/JMX input, confirm the KEYSPACE item is present and non-null in the source data","Check the object construction site to make sure the keyspace parameter is not accidentally passed as null"],"exampleFix":"// before\nnew CompressionDictionaryDataObject(null, \"tbl\", tableId, dictId, dict, dictLength, \"zstd\", checksum, createdAt);\n// after\nnew CompressionDictionaryDataObject(\"ks\", \"tbl\", tableId, dictId, dict, dictLength, \"zstd\", checksum, createdAt);","handlingStrategy":"validation","validationCode":"if (obj.keyspace == null || obj.keyspace.isEmpty()) throw new IllegalArgumentException(\"keyspace must be set before creating CompressionDictionaryDataObject\");","typeGuard":"boolean hasKeyspace(CompressionDictionaryDataObject o) { return o.keyspace != null && !o.keyspace.isEmpty(); }","tryCatchPattern":"try { tabularData.fromDataObject(obj); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Keyspace not specified\")) { /* rebuild descriptor with keyspace */ } else throw e; }","preventionTips":["Always populate keyspace from the fully-qualified 'ks.tbl' target before constructing the data object","Add a unit test constructing the data object with all fields set","When converting from CompositeData, assert all required items exist first"],"tags":["jmx","validation","compression-dictionary"],"backgroundTag":"missing-required-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"}