apache/cassandra · error · IllegalStateException

%s compression dictionary is not created for dict id %s

Error message

%s compression dictionary is not created for dict id %s

What it means

createFromRowLightweight builds a CompressionDictionary from a row of the dictionary system table by delegating to the Kind-specific factory. If the factory rejects the parameters with an IllegalArgumentException (e.g. dictionary bytes too small or invalid for the kind), it is converted to an IllegalStateException stating that no dictionary of that kind could be created for the given dict id.

Source

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

        int size = row.getInt("dict_length");
        String keyspaceName = row.getString("keyspace_name");
        String tableName = row.getString("table_name");
        String tableId = row.getString("table_id");
        Instant createdAt = row.getTimestamp("created_at").toInstant();

        try
        {
            return new LightweightCompressionDictionary(keyspaceName,
                                                        tableName,
                                                        tableId,
                                                        new DictId(CompressionDictionary.Kind.valueOf(kindStr), dictId),
                                                        checksum,
                                                        size,
                                                        createdAt);
        }
        catch (IllegalArgumentException ex)
        {
            throw new IllegalStateException(kindStr + " compression dictionary is not created for dict id " + dictId);
        }
    }

    static CompressionDictionary createFromRow(UntypedResultSet.Row row)
    {
        String kindStr = row.getString("kind");
        long dictId = row.getLong("dict_id");
        byte[] dict = row.getByteArray("dict");
        int storedLength = row.getInt("dict_length");
        int storedChecksum = row.getInt("dict_checksum");
        Instant createdAt = row.getTimestamp("created_at").toInstant();

        try
        {
            Kind kind = CompressionDictionary.Kind.valueOf(kindStr);

            // Validate length
            if (dict.length != storedLength)

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Delete the invalid dictionary row/file and allow the node to regenerate or re-fetch the dictionary.
  2. Regenerate the zstd dictionary via the dictionary training mechanism and re-ingest it.
  3. Verify integrity of the system table storage / underlying SSTables (nodetool scrub if needed).
  4. Check for version skew between nodes that wrote and read the dictionary row.

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

// verify dictionary row sanity before use
if (dictBytes == null || dictBytes.length == 0 || dictBytes.length != storedSize)
    throw new IllegalStateException("dictionary row inconsistent for id " + dictId);

Try / catch

try {
    d = createFromRowLightweight(row);
} catch (IllegalStateException e) {
    logger.warn("Falling back after invalid dictionary: {}", e.getMessage());
    d = defaultCompression();
}

Prevention

When it happens

Trigger: Loading a zstd (or other kind) dictionary from the system dictionary table where the stored bytes/size/checksum are not valid for the kind's createDictionary — commonly zero-length or truncated dictionary blobs.

Common situations: Partially written dictionary rows during crashes, corrupt storage, or version differences where a kind's validation rules changed.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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