risingwavelabs/risingwave · error · SinkError::Config

`starrocks.max_batch_size_bytes` must be greater than 0

Error message

`starrocks.max_batch_size_bytes` must be greater than 0

What it means

This error is thrown by `StarrocksConfig::from_btreemap` when the user-provided property `starrocks.max_batch_size_bytes` is explicitly set to `0`. The batch size controls how many bytes are accumulated before flushing a stream-load batch to StarRocks; a zero value would prevent any batching from working, so the config is rejected at sink creation.

Solutions

  1. Set `starrocks.max_batch_size_bytes` to a positive byte value (e.g. '1048576') in the sink WITH options
  2. Remove the option entirely to use the default batch size
  3. Verify any SQL templating/variables actually substitute a positive integer

Example fix

// before
CREATE SINK s FROM mv INTO starrocks WITH (
  'starrocks.max_batch_size_bytes' = '0'
);
// after
CREATE SINK s FROM mv INTO starrocks WITH (
  'starrocks.max_batch_size_bytes' = '1048576'
);
Defensive patterns

Strategy: validation

Validate before calling

let batch = props.get("starrocks.max_batch_size_bytes").map(|v| v.parse::<u64>().ok());
if batch == Some(Some(0)) {
    return Err("starrocks.max_batch_size_bytes must be > 0");
}

Prevention

When it happens

Trigger: Creating a StarRocks sink with a WITH option `starrocks.max_batch_size_bytes` = '0'. The check only fires on exactly `Some(0)`; unset or positive values pass.

Common situations: Copy-pasted sink DDL with a placeholder 0, templated configs where the variable was not substituted, or an attempt to disable batching by setting the size to zero (which is not supported).

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

Appendix: source

Thrown at src/connector/src/sink/starrocks.rs:174

    pub fn from_btreemap(properties: BTreeMap<String, String>) -> Result<Self> {
        let config =
            serde_json::from_value::<StarrocksConfig>(serde_json::to_value(properties).unwrap())
                .map_err(|e| SinkError::Config(anyhow!(e)))?;
        if config.r#type != SINK_TYPE_APPEND_ONLY && config.r#type != SINK_TYPE_UPSERT {
            return Err(SinkError::Config(anyhow!(
                "`{}` must be {}, or {}",
                SINK_TYPE_OPTION,
                SINK_TYPE_APPEND_ONLY,
                SINK_TYPE_UPSERT
            )));
        }
        if config.commit_checkpoint_interval == 0 {
            return Err(SinkError::Config(anyhow!(
                "`commit_checkpoint_interval` must be greater than 0"
            )));
        }
        if let Some(0) = config.max_batch_size_bytes {
            return Err(SinkError::Config(anyhow!(
                "`starrocks.max_batch_size_bytes` must be greater than 0"
            )));
        }
        Ok(config)
    }
}

#[derive(Debug, PartialEq, Eq)]
struct LoadRequestSizeDecision {
    finish_current_load: bool,
    next_batch_size_bytes: u64,
}

fn decide_load_request_size(
    current_batch_size_bytes: u64,
    row_size: u64,
    max_batch_size_bytes: u64,
) -> Result<LoadRequestSizeDecision> {

View on GitHub (pinned to 6469eb736d)