apache/cassandra · error · IllegalArgumentException

Keyspace not specified.

Error message

Keyspace not specified.

What it means

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.

Source

Thrown at src/java/org/apache/cassandra/db/compression/CompressionDictionaryDetailsTabularData.java:288

        /**
         * An object of this class is considered to be valid if:
         *
         * <ul>
         *     <li>keyspace, table and table id are not null</li>
         *     <li>dict id is lower than 0</li>
         *     <li>dict is not null nor empty</li>
         *     <li>dict length is less than or equal to 1MiB</li>
         *     <li>kind is not null and there is such {@link org.apache.cassandra.db.compression.CompressionDictionary.Kind}</li>
         *     <li>dictLength is bigger than 0</li>
         *     <li>dictLength has to be equal to dict's length</li>
         *     <li>dictChecksum has to be equal to checksum computed as part of this method</li>
         *     <li>creation date is not null</li>
         * </ul>
         */
        private void validate()
        {
            if (keyspace == null)
                throw new IllegalArgumentException("Keyspace not specified.");
            if (table == null)
                throw new IllegalArgumentException("Table not specified.");
            if (tableId == null)
                throw new IllegalArgumentException("Table id not specified.");
            if (dictId <= 0)
                throw new IllegalArgumentException("Provided dictionary id must be positive but it is '" + dictId + "'.");
            if (dict == null || dict.length == 0)
                throw new IllegalArgumentException("Provided dictionary byte array is null or empty.");
            if (kind == null)
                throw new IllegalArgumentException("Provided kind is null.");

            CompressionDictionary.Kind dictionaryKind;

            try
            {
                dictionaryKind = CompressionDictionary.Kind.valueOf(kind);
            }
            catch (IllegalArgumentException ex)

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Set a valid keyspace name on the CompressionDictionaryDataObject before it is validated
  2. If building from CompositeData/JMX input, confirm the KEYSPACE item is present and non-null in the source data
  3. Check the object construction site to make sure the keyspace parameter is not accidentally passed as null

Example fix

// before
new CompressionDictionaryDataObject(null, "tbl", tableId, dictId, dict, dictLength, "zstd", checksum, createdAt);
// after
new CompressionDictionaryDataObject("ks", "tbl", tableId, dictId, dict, dictLength, "zstd", checksum, createdAt);
Defensive patterns

Strategy: validation

Validate before calling

if (obj.keyspace == null || obj.keyspace.isEmpty()) throw new IllegalArgumentException("keyspace must be set before creating CompressionDictionaryDataObject");

Type guard

boolean hasKeyspace(CompressionDictionaryDataObject o) { return o.keyspace != null && !o.keyspace.isEmpty(); }

Try / catch

try { tabularData.fromDataObject(obj); } catch (IllegalArgumentException e) { if (e.getMessage().contains("Keyspace not specified")) { /* rebuild descriptor with keyspace */ } else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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