risingwavelabs/risingwave · error · SinkError::Config
`compaction.max_snapshots_num` must be greater than 0
Error message
`compaction.max_snapshots_num` must be greater than 0
What it means
Numeric option validation in IcebergSinkConfig::from_btreemap: the compaction option `compaction.max_snapshots_num` was set to 0, which is meaningless (it would compact after every snapshot). The guard rejects zero values during sink creation or ALTER; positive integers pass.
Source
Thrown at src/connector/src/sink/iceberg/config.rs:643
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!(
"`compaction.delete_files_count_threshold` must be greater than 0"
)));
}
if config.target_file_size_mb == Some(0) {
return Err(SinkError::Config(anyhow!(View on GitHub (pinned to 6469eb736d)
Solutions
- Set `max_snapshots_num_before_compaction` to a positive integer, e.g. 100.
- Remove the option to use the default retention threshold.
Example fix
// before WITH (connector = 'iceberg', max_snapshots_num = 0) // after WITH (connector = 'iceberg', max_snapshots_num = 100)
Defensive patterns
Strategy: validation
Validate before calling
if (opts.max_snapshots_num != null && Number(opts.max_snapshots_num) <= 0) {
throw new Error('`compaction.max_snapshots_num` 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('max_snapshots_num')) {
delete opts.max_snapshots_num;
return createIcebergSink(opts);
}
throw e;
} Prevention
- Never emit compaction options with 0 values from templates.
- Sanitize numeric inputs from config forms.
- Prefer omitting options over sending placeholder values.
When it happens
Trigger: CREATE SINK with `compaction.max_snapshots_num = 0` (option `max_snapshots_num_before_compaction`) in the WITH options.
Common situations: Zero used as a placeholder in automation; users expecting 0 to mean 'no snapshot limit'; misconfigured tuning attempts.
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
- `compaction_interval_sec` must be greater than 0
- `compaction.trigger_snapshot_count` must be greater than 0
- `compaction.small_files_threshold_mb` must be greater than 0
- `compaction.delete_files_count_threshold` must be greater th
- `compaction.target_file_size_mb` must be greater than 0
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/92180ca5df9076dc.
Report an issue: GitHub.