apache/cassandra · error · IllegalStateException

The compression on table %s.%s is not enabled or SSTable com

Error message

The compression on table %s.%s is not enabled or SSTable compressor is not a dictionary compressor.

What it means

importCompressionDictionary() only works when the target table currently has dictionary compression enabled and its SSTable compressor is a dictionary compressor (isEnabled && kind != null). Otherwise the manager cannot accept or place an imported dictionary, and IllegalStateException is thrown. This is a precondition check performed before parsing the incoming CompositeData.

Source

Thrown at src/java/org/apache/cassandra/db/compression/CompressionDictionaryManager.java:269

        return CompressionDictionaryDetailsTabularData.fromCompressionDictionary(keyspaceName, tableName, tableId, compressionDictionary);
    }

    @Override
    public CompositeData getCompressionDictionary(long dictId)
    {
        CompressionDictionary compressionDictionary = SystemDistributedKeyspace.retrieveCompressionDictionary(keyspaceName, tableName, tableId, dictId);
        if (compressionDictionary == null)
            return null;

        return CompressionDictionaryDetailsTabularData.fromCompressionDictionary(keyspaceName, tableName, tableId, compressionDictionary);
    }

    @Override
    public synchronized void importCompressionDictionary(CompositeData compositeData)
    {
        if (!isEnabled || this.kind == null)
        {
            throw new IllegalStateException(format("The compression on table %s.%s is not enabled or SSTable compressor is not a dictionary compressor.",
                                                   keyspaceName, tableName));
        }

        CompressionDictionaryDataObject dataObject = CompressionDictionaryDetailsTabularData.fromCompositeData(compositeData);

        if (!keyspaceName.equals(dataObject.keyspace) || !tableName.equals(dataObject.table))
            throw new IllegalArgumentException(format("Keyspace and table of a dictionary to import (%s.%s) does not correspond to the keyspace and table this manager is responsible for (%s.%s)",
                                                      dataObject.keyspace, dataObject.table,
                                                      keyspaceName, tableName));

        CompressionDictionary.Kind kind = CompressionDictionary.Kind.valueOf(dataObject.kind);

        if (this.kind != kind)
        {
            throw new IllegalArgumentException(format("It is not possible to import compression dictionaries of kind " +
                                                      "%s into table %s.%s which supports compression dictionaries of kind %s.",
                                                      kind, keyspaceName, tableName, this.kind));
        }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Enable dictionary compression on the target table first (ALTER TABLE ... WITH compression = {'class': '<dictionary compressor>', ...}).
  2. Verify with DESCRIBE TABLE that the compression class is a dictionary compressor before importing.
  3. Ensure the import is targeting the same table the dictionary was trained/exported from.
  4. If the feature flag for compression dictionaries is disabled on the node, enable it in cassandra.yaml / via the appropriate config.

Example fix

// before
manager.importCompressionDictionary(compositeData); // IllegalStateException on non-dictionary table
// after
ALTER TABLE ks.tbl WITH compression = {'class': 'org.apache.cassandra.io.compress.ZstdDictionaryCompressor'};
// then re-run the import
manager.importCompressionDictionary(compositeData);
Defensive patterns

Strategy: validation

Validate before calling

if (manager.isEnabled && manager.getCurrentKind() != null) manager.importCompressionDictionary(data);

Try / catch

try { manager.importCompressionDictionary(data); } catch (IllegalStateException e) { /* enable dictionary compression on the table first */ }

Prevention

When it happens

Trigger: Calling importCompressionDictionary(CompositeData) on a table where dictionary compression is disabled (isEnabled == false) or where the current compressor is not a dictionary compressor (this.kind == null).

Common situations: Importing a dictionary into a table whose compression was switched to a plain compressor; importing into a table that never had dictionary compression enabled; running the import on the wrong table/keyspace by mistake; importing before the dictionary feature was enabled on the target cluster.

Related errors


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