apache/cassandra · error · IOException

Invalid compression dictionary kind: %s

Error message

Invalid compression dictionary kind: %s

What it means

CompressionDictionary.deserialize reads a dictionary from a stream: the first field is an ordinal indexing the Kind enum. If the ordinal is negative or beyond the number of known kinds, the stream is corrupted, written by an incompatible/newer version, or truncated, so an IOException is thrown rather than indexing out of bounds.

Source

Thrown at src/java/org/apache/cassandra/db/compression/CompressionDictionary.java:231

     * @throws IOException on any I/O exception when reading from the file
     */
    @Nullable
    static CompressionDictionary deserialize(DataInput input, @Nullable CompressionDictionaryManager manager) throws IOException
    {
        int kindOrdinal;
        try
        {
            kindOrdinal = input.readByte();
        }
        catch (EOFException eof)
        {
            // no dictionary
            return null;
        }

        if (kindOrdinal < 0 || kindOrdinal >= Kind.values().length)
        {
            throw new IOException("Invalid compression dictionary kind: " + kindOrdinal);
        }
        Kind kind = Kind.values()[kindOrdinal];
        long id = input.readLong();
        DictId dictId = new DictId(kind, id);

        if (manager != null)
        {
            CompressionDictionary dictionary = manager.get(dictId);
            if (dictionary != null)
            {
                return dictionary;
            }
        }

        int length = input.readInt();
        byte[] dict = new byte[length];
        input.readFully(dict);
        int checksum = input.readInt();

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Verify the dictionary file/table data is intact and complete (check file sizes, re-transfer).
  2. Ensure the node version supports the dictionary kind that wrote the data; align cluster versions.
  3. Regenerate the dictionary (e.g. re-create zstd dictionary training) if the source is unrecoverable.
  4. Restore the affected SSTables/files from backup.

Example fix

null
Defensive patterns

Strategy: try-catch

Try / catch

try {
    dict = CompressionDictionary.deserialize(input, manager);
} catch (IOException e) {
    if (e.getMessage().startsWith("Invalid compression dictionary kind")) { retransferOrRegenerateDictionary(); }
    else throw e;
}

Prevention

When it happens

Trigger: Reading a serialized compression dictionary (dictionary file or system table blob) whose kind ordinal byte/int falls outside [0, Kind.values().length).

Common situations: Upgrading/downgrading between Cassandra versions with different Kind sets, corrupted SSTable or dictionary files, hand-edited or partially written files.

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/4841ef275fe58005. Report an issue: GitHub.