risingwavelabs/risingwave · error · SinkError::Config

`compaction.trigger_snapshot_count` must be greater than 0

Error message

`compaction.trigger_snapshot_count` must be greater than 0

What it means

Raised when `trigger_snapshot_count` is Some(0) in an Iceberg sink config. This option controls how many snapshots trigger compaction; it must be at least 1. Zero is rejected during from_btreemap validation.

Source

Thrown at src/connector/src/sink/iceberg/config.rs:637

        );
        config
            .unknown_fields
            .retain(|key, _| key != "connector" && !key.starts_with("catalog."));

        if config.commit_checkpoint_interval == 0 {
            return Err(SinkError::Config(anyhow!(
                "`commit-checkpoint-interval` must be greater than 0"
            )));
        }

        if config.compaction_interval_sec == Some(0) {
            return Err(SinkError::Config(anyhow!(
                "`compaction_interval_sec` must be greater than 0"
            )));
        }

        if config.trigger_snapshot_count == Some(0) {
            return Err(SinkError::Config(anyhow!(
                "`compaction.trigger_snapshot_count` must be greater than 0"
            )));
        }

        if config.max_snapshots_num_before_compaction == Some(0) {
            return Err(SinkError::Config(anyhow!(
                "`compaction.max_snapshots_num` must be greater than 0"
            )));
        }

        if config.small_files_threshold_mb == Some(0) {
            return Err(SinkError::Config(anyhow!(
                "`compaction.small_files_threshold_mb` must be greater than 0"
            )));
        }

        if config.delete_files_count_threshold == Some(0) {
            return Err(SinkError::Config(anyhow!(

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Set `trigger_snapshot_count` to a positive integer, e.g. 5.
  2. Remove the option to rely on the default trigger count.
  3. If compaction is unwanted, adjust `compaction_interval_sec` instead of zeroing thresholds.

Example fix

// before
WITH (connector = 'iceberg', trigger_snapshot_count = 0)
// after
WITH (connector = 'iceberg', trigger_snapshot_count = 5)
Defensive patterns

Strategy: validation

Validate before calling

if (opts.trigger_snapshot_count != null && Number(opts.trigger_snapshot_count) <= 0) {
  throw new Error('`compaction.trigger_snapshot_count` must be greater than 0');
}

Type guard

function isValidOptionalPositive(v) {
  return v == null || (Number.isInteger(v) && v > 0);
}

Try / catch

try {
  await createIcebergSink(opts);
} catch (e) {
  if (String(e).includes('trigger_snapshot_count')) {
    delete opts.trigger_snapshot_count;
    return createIcebergSink(opts);
  }
  throw e;
}

Prevention

When it happens

Trigger: CREATE SINK with `compaction.trigger_snapshot_count = 0` (option `trigger_snapshot_count`) in the WITH options.

Common situations: Placeholder values in generated DDL; users experimenting with compaction thresholds and entering 0; confusion between 'count' and 'disabled'.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/e1a36c9773dd2cdd. Report an issue: GitHub.