apache/cassandra · error · IllegalArgumentException

There is no such dictionary kind like '<kind>'. Available ki

Error message

There is no such dictionary kind like '<kind>'. Available kinds: <kinds>.

What it means

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.

Source

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

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

            int checksumOfDictionaryToImport = CompressionDictionary.calculateChecksum((byte) dictionaryKind.ordinal(), dictId, dict);
            if (checksumOfDictionaryToImport != dictChecksum)
            {
                throw new IllegalArgumentException(format("Computed checksum of dictionary to import (%s) is different from checksum specified on input (%s).",
                                                          checksumOfDictionaryToImport,
                                                          dictChecksum));
            }
        }
    }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Use the exact enum constant name, e.g. CompressionDictionary.Kind.ZSTD.name(), not a lower-case string
  2. Match the case exactly (valueOf is case-sensitive)
  3. Print CompressionDictionary.Kind.values() (already in the message) and pick one of the listed kinds
  4. If the algorithm is genuinely unsupported, use one of the available kinds or upgrade Cassandra

Example fix

// before
String kind = "zstd"; // wrong case
// after
String kind = CompressionDictionary.Kind.ZSTD.name(); // exact enum name
Defensive patterns

Strategy: validation

Validate before calling

boolean validKind = Arrays.stream(CompressionDictionary.Kind.values()).anyMatch(k -> k.name().equals(obj.kind));
if (!validKind) throw new IllegalArgumentException("Unknown kind: " + obj.kind);

Type guard

boolean isKnownKind(String s) { return s != null && Arrays.stream(CompressionDictionary.Kind.values()).anyMatch(k -> k.name().equals(s)); }

Try / catch

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

Prevention

When it happens

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

Common situations: Lower-cased algorithm names from config files or CLI flags; names from older/newer versions whose enum constants differ; hand-typed JMX imports.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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