{"record":{"id":"254519aca32573cd","repo":"apache/cassandra","slug":"the-compression-on-table-s-s-is-not-enabled-or-s","errorCode":null,"errorMessage":"The compression on table %s.%s is not enabled or SSTable compressor is not a dictionary compressor.","messagePattern":"The compression on table (.+?)\\.(.+?) is not enabled or SSTable compressor is not a dictionary compressor\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compression/CompressionDictionaryManager.java","lineNumber":269,"sourceCode":"        return CompressionDictionaryDetailsTabularData.fromCompressionDictionary(keyspaceName, tableName, tableId, compressionDictionary);\n    }\n\n    @Override\n    public CompositeData getCompressionDictionary(long dictId)\n    {\n        CompressionDictionary compressionDictionary = SystemDistributedKeyspace.retrieveCompressionDictionary(keyspaceName, tableName, tableId, dictId);\n        if (compressionDictionary == null)\n            return null;\n\n        return CompressionDictionaryDetailsTabularData.fromCompressionDictionary(keyspaceName, tableName, tableId, compressionDictionary);\n    }\n\n    @Override\n    public synchronized void importCompressionDictionary(CompositeData compositeData)\n    {\n        if (!isEnabled || this.kind == null)\n        {\n            throw new IllegalStateException(format(\"The compression on table %s.%s is not enabled or SSTable compressor is not a dictionary compressor.\",\n                                                   keyspaceName, tableName));\n        }\n\n        CompressionDictionaryDataObject dataObject = CompressionDictionaryDetailsTabularData.fromCompositeData(compositeData);\n\n        if (!keyspaceName.equals(dataObject.keyspace) || !tableName.equals(dataObject.table))\n            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)\",\n                                                      dataObject.keyspace, dataObject.table,\n                                                      keyspaceName, tableName));\n\n        CompressionDictionary.Kind kind = CompressionDictionary.Kind.valueOf(dataObject.kind);\n\n        if (this.kind != kind)\n        {\n            throw new IllegalArgumentException(format(\"It is not possible to import compression dictionaries of kind \" +\n                                                      \"%s into table %s.%s which supports compression dictionaries of kind %s.\",\n                                                      kind, keyspaceName, tableName, this.kind));\n        }","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compression/CompressionDictionaryManager.java#L251-L287","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Enable dictionary compression on the target table first (ALTER TABLE ... WITH compression = {'class': '<dictionary compressor>', ...}).","Verify with DESCRIBE TABLE that the compression class is a dictionary compressor before importing.","Ensure the import is targeting the same table the dictionary was trained/exported from.","If the feature flag for compression dictionaries is disabled on the node, enable it in cassandra.yaml / via the appropriate config."],"exampleFix":"// before\nmanager.importCompressionDictionary(compositeData); // IllegalStateException on non-dictionary table\n// after\nALTER TABLE ks.tbl WITH compression = {'class': 'org.apache.cassandra.io.compress.ZstdDictionaryCompressor'};\n// then re-run the import\nmanager.importCompressionDictionary(compositeData);","handlingStrategy":"validation","validationCode":"if (manager.isEnabled && manager.getCurrentKind() != null) manager.importCompressionDictionary(data);","typeGuard":null,"tryCatchPattern":"try { manager.importCompressionDictionary(data); } catch (IllegalStateException e) { /* enable dictionary compression on the table first */ }","preventionTips":["Confirm the target table's compression is a dictionary compressor before importing","Keep the feature enabled on all nodes that receive imports","Import only into the same table the dictionary was trained on"],"tags":["compression","dictionary-import","precondition"],"backgroundTag":"feature-not-enabled","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}