{"record":{"id":"9f7b6d1ec9e3ccf8","repo":"apache/cassandra","slug":"it-is-not-possible-to-import-compression-dictionar","errorCode":null,"errorMessage":"It is not possible to import compression dictionaries of kind %s into table %s.%s which supports compression dictionaries of kind %s.","messagePattern":"It is not possible to import compression dictionaries of kind (.+?) into table (.+?)\\.(.+?) which supports compression dictionaries of kind (.+?)\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compression/CompressionDictionaryManager.java","lineNumber":284,"sourceCode":"    {\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        }\n\n        CompressionDictionary.DictId dictId = new CompressionDictionary.DictId(kind, dataObject.dictId);\n\n        LightweightCompressionDictionary latestCompressionDictionary = retrieveLightweightLatestCompressionDictionary(keyspaceName, tableName, tableId);\n        if (latestCompressionDictionary != null)\n        {\n            if (latestCompressionDictionary.dictId.id > dictId.id)\n            {\n                throw new IllegalArgumentException(format(\"Dictionary to import has older dictionary id (%s) than the latest compression dictionary (%s) for table %s.%s\",\n                                                          dictId.id, latestCompressionDictionary.dictId.id, keyspaceName, tableName));\n            }\n\n            checkTrainingFrequency(latestCompressionDictionary, createTrainingConfig(Map.of()));\n        }\n","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compression/CompressionDictionaryManager.java#L266-L302","documentation":"Each table supports exactly one dictionary kind (e.g. Zstd). If the imported dictionary's kind (parsed from dataObject.kind) differs from the manager's configured kind, importCompressionDictionary() throws IllegalArgumentException, since a dictionary of an incompatible algorithm cannot be used by the table's compressor.","triggerScenarios":"Importing a dictionary whose kind enum name in the CompositeData does not equal the table's current dictionary compressor kind (this.kind != kind).","commonSituations":"Table compression switched between dictionary compressor types after the dictionary was exported; exporting from a cluster using one dictionary compressor and importing into a cluster configured with another; typos or wrong value in the 'kind' field of hand-built import data.","solutions":["Import a dictionary whose kind matches the table's configured dictionary compressor, or retrain the dictionary with the correct compressor.","Change the table's compression to the kind matching the dictionary before importing.","Verify the 'kind' string in the export exactly matches CompressionDictionary.Kind names.","Keep compressor configuration consistent between source and destination clusters when copying dictionaries."],"exampleFix":"// before\n// table uses Zstd, imported dictionary kind = \"Zlib\"\ndataObject.kind = \"Zlib\";\n// after\ndataObject.kind = manager.getCurrentKind().name(); // e.g. \"Zstd\" — must match table's compressor kind","handlingStrategy":"validation","validationCode":"if (CompressionDictionary.Kind.valueOf(dataObject.kind) == manager.getCurrentKind()) manager.importCompressionDictionary(data);","typeGuard":null,"tryCatchPattern":"try { manager.importCompressionDictionary(data); } catch (IllegalArgumentException e) { /* kind mismatch: retrain or realign compressor */ }","preventionTips":["Keep dictionary compressor configuration identical across clusters exchanging dictionaries","Validate the kind field in exports before import","Retrain rather than importing across incompatible compressor kinds"],"tags":["compression","dictionary-import","enum-mismatch"],"backgroundTag":"invalid-enum-value","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"}