risingwavelabs/risingwave · error · SinkError::Config

`compaction_interval_sec` must be greater than 0

Error message

`compaction_interval_sec` must be greater than 0

What it means

Raised when `compaction_interval_sec` is explicitly set to Some(0) on an Iceberg sink config. The compaction interval must be a positive number of seconds; zero is meaningless and rejected at parse time.

Source

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

        // All configs start with "catalog." will be treated as java configs.
        config.java_catalog_props = iceberg_java_catalog_props_from_options(
            values
                .iter()
                .map(|(key, value)| (key.as_str(), value.as_str())),
        );
        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!(

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Set `compaction_interval_sec` to a positive integer, e.g. 300.
  2. Remove the option to use the built-in default.
  3. To reduce compaction, set a large interval rather than 0.

Example fix

// before
WITH (connector = 'iceberg', compaction_interval_sec = 0)
// after
WITH (connector = 'iceberg', compaction_interval_sec = 300)
Defensive patterns

Strategy: validation

Validate before calling

if (opts.compaction_interval_sec != null && Number(opts.compaction_interval_sec) <= 0) {
  throw new Error('`compaction_interval_sec` 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('compaction_interval_sec')) {
    delete opts.compaction_interval_sec;
    return createIcebergSink(opts);
  }
  throw e;
}

Prevention

When it happens

Trigger: CREATE SINK with `compaction_interval_sec = 0` in the WITH options of an Iceberg sink.

Common situations: Users trying to 'disable' compaction by setting the interval to 0 instead of omitting the option; templated configs with unset variables defaulting to 0.

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/02f47319fae37049. Report an issue: GitHub.