apache/cassandra · error · IllegalArgumentException
Compressor does not support dictionary training: <compressor
Error message
Compressor does not support dictionary training: <compressor>
What it means
Thrown by ICompressionDictionaryTrainer.create when the table's SSTable compressor does not implement IDictionaryCompressor, meaning dictionary training is impossible for that compressor. It is an IllegalArgumentException signaling programmatic misuse of the training API.
Source
Thrown at src/java/org/apache/cassandra/db/compression/ICompressionDictionaryTrainer.java:124
void setDictionaryTrainedListener(Consumer<CompressionDictionary> listener);
/**
* Factory method to create appropriate trainer based on compression parameters.
*
* @param keyspaceName the keyspace name for logging
* @param tableName the table name for logging
* @param params the compression parameters
* @return a dictionary trainer for the specified compression algorithm
* @throws IllegalArgumentException if no dictionary trainer is available for the compression algorithm
*/
static ICompressionDictionaryTrainer create(String keyspaceName,
String tableName,
CompressionParams params)
{
ICompressor compressor = params.getSstableCompressor();
if (!(compressor instanceof IDictionaryCompressor))
{
throw new IllegalArgumentException("Compressor does not support dictionary training: " + params.getSstableCompressor());
}
IDictionaryCompressor<?> dictionaryCompressor = (IDictionaryCompressor<?>) compressor;
return dictionaryCompressor.acceptableDictionaryKind().createTrainer(keyspaceName, tableName, compressor);
}
enum TrainingStatus
{
NOT_STARTED,
SAMPLING,
TRAINING,
COMPLETED,
FAILED
}
}
View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Switch the table's compressor to a dictionary-capable one (e.g. Zstd dictionary compressor) via ALTER TABLE compression options
- Check params.getSstableCompressor() instanceof IDictionaryCompressor before calling create
- Refrain from training on tables that do not opt into dictionary compression
Example fix
// before
ICompressionDictionaryTrainer.create(ks, table, tableMetadata.params()); // throws for non-dictionary compressor
// after
if (params.getSstableCompressor() instanceof IDictionaryCompressor)
ICompressionDictionaryTrainer.create(ks, table, params); Defensive patterns
Strategy: type-guard
Validate before calling
boolean canTrain(CompressionParams p) { return p.getSstableCompressor() instanceof IDictionaryCompressor; } Type guard
if (!(params.getSstableCompressor() instanceof IDictionaryCompressor)) return null;
Try / catch
try { trainer = ICompressionDictionaryTrainer.create(ks, table, params); } catch (IllegalArgumentException e) { /* fall back to non-dictionary path */ } Prevention
- Check compressor capability before invoking training APIs
- Only enable training on tables using dictionary-capable compressors
- Document compressor constraints in operational runbooks
When it happens
Trigger: Invoking dictionary training (create) on a table whose compression params use a non-dictionary compressor such as LZ4Compressor without dictionary support, Snappy, Deflate, or Zstd configured without dictionary capability.
Common situations: Running training tools against tables compressed with algorithms that lack dictionary support; assuming all compressors support training; misconfigured compression class in the table schema.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Chunk cache size cannot be changed.
- compressed_read_ahead_buffer_size must be at least 256KiB (s
- %s
- <ConfigurationException message>
- Invalid compression dictionary kind: %s
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/784bbfef9d4a0b38.
Report an issue: GitHub.