apache/cassandra · error · IllegalArgumentException

Provided kind is null.

Error message

Provided kind is null.

What it means

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).

Source

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

         *     <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)
            {
                throw new IllegalArgumentException("There is no such dictionary kind like '" + kind + "'. Available kinds: " + Arrays.asList(CompressionDictionary.Kind.values()));
            }

            if (dictLength <= 0)
                throw new IllegalArgumentException("Size has to be strictly positive number, it is '" + dictLength + "'.");
            if (dict.length != dictLength)
                throw new IllegalArgumentException("The length of the provided dictionary array (" + dict.length + ") is not equal to provided length value (" + dictLength + ").");
            if (createdAt == null)
                throw new IllegalArgumentException("The creation date not specified.");

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Set the kind string to a valid CompressionDictionary.Kind name (e.g. "ZSTD") before validation
  2. Read the kind from the existing dictionary metadata rather than leaving it unset
  3. Check the JMX/CompositeData input includes a non-null KIND value

Example fix

// before
String kind = null; // omitted in descriptor
// after
String kind = CompressionDictionary.Kind.ZSTD.name();
Defensive patterns

Strategy: validation

Validate before calling

if (obj.kind == null) throw new IllegalArgumentException("kind must be set (e.g. " + CompressionDictionary.Kind.ZSTD.name() + ")");

Type guard

boolean hasKind(CompressionDictionaryDataObject o) { return o.kind != null; }

Try / catch

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; }

Prevention

When it happens

Trigger: Building a CompressionDictionaryDataObject without setting the kind (e.g. zstd) — the string field was never populated or the CompositeData lacked the KIND item.

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

Related errors


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