risingwavelabs/risingwave · error · SinkError::Config

`compaction.target_file_size_mb` must be greater than 0

Error message

`compaction.target_file_size_mb` must be greater than 0

What it means

Numeric option validation in IcebergSinkConfig::from_btreemap: `compaction.target_file_size_mb` was set to 0, which would produce zero-byte target files during compaction. The guard rejects non-positive values while parsing the sink's with-clause options.

Source

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

            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!(
                "`compaction.delete_files_count_threshold` must be greater than 0"
            )));
        }

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

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

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

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

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Set `target_file_size_mb` to a positive integer, e.g. 128.
  2. Remove the option to use the Iceberg default target file size.

Example fix

// before
WITH (connector = 'iceberg', target_file_size_mb = 0)
// after
WITH (connector = 'iceberg', target_file_size_mb = 128)
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: CREATE SINK with `compaction.target_file_size_mb = 0` in the WITH options.

Common situations: Zero placeholder values; users attempting 'write everything as small files' experiments; unit confusion when copying configs from other systems.

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