apache/cassandra · warning

Failed to create for . , reason

Error message

Failed to create %s for %s.%s, reason: %s

What it means

ZstdDictionaryTrainer.start logs this formatted warning when training a zstd compression dictionary with ZstdDictTrainer fails for a table. The trainer sets TrainingStatus.FAILED and stores the message; the table simply continues without a trained dictionary (falls back to normal zstd without a dictionary).

Solutions

  1. Read the embedded reason (%s at the end) to identify the root cause — most commonly a native zstd or sampling error.
  2. Ensure the table has enough data samples and that dictionary training thresholds in cassandra.yaml are appropriate (not requiring more samples than exist).
  3. Retry training after freeing heap/native memory or reducing sample size limits.
  4. Confirm the JVM's zstd build supports dictionary training; otherwise disable dictionary training for the table via compression options.
Defensive patterns

Strategy: validation

Validate before calling

// pre-check sample availability before enabling training
if (table.getLiveSSTables().size() < minSamplesForTraining) {
    logger.info("Not enough samples to train dictionary for {}.{}", ks, table);
    return false;
}

Try / catch

try {
    boolean trained = trainer.start();
} catch (Exception e) {
    logger.warn("Dictionary training failed: {}", e.getMessage());
}

Prevention

When it happens

Trigger: An exception is thrown during the training run (ZstdDictTrainer.trainSamples / fitSamples) — e.g. insufficient or oversized sample set, native zstd trainer error, OOM during training, or IO problems collecting samples; the message embeds the table keyspace/name and exception message.

Common situations: Dictionary training enabled with too few or malformed sample sstables; memory pressure causing zstd training failure on large samples; zstd native library lacking trainer support; training on a table with tiny or highly uniform data.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/db/compression/ZstdDictionaryTrainer.java:304

            return false;

        try
        {
            // reset on starting; a new zstdTrainer instance is created during reset
            reset(trainingConfig);
            currentTrainingStatus = TrainingStatus.SAMPLING;
            failureMessage = null; // Clear any previous failure message
            return true;
        }
        catch (Exception e)
        {
            String message = String.format("Failed to create %s for %s.%s, reason: %s",
                                           ZstdDictTrainer.class.getSimpleName(),
                                           keyspaceName,
                                           tableName,
                                           e.getMessage());

            logger.warn(message);
            failureMessage = message;
            currentTrainingStatus = TrainingStatus.FAILED;
        }
        return false;
    }

    @Override
    public void reset(CompressionDictionaryTrainingConfig trainingConfig)
    {
        if (closed)
        {
            return;
        }

        currentTrainingStatus = TrainingStatus.NOT_STARTED;
        synchronized (this)
        {
            totalSampleSize.set(0);

View on GitHub (pinned to 88fd0f6a0e)