risingwavelabs/risingwave · error

Invalid value for , should be in range [0, ]

Error message

Invalid value for {}, should be in range [0,{}] 

What it means

When backfill v2 is enabled and 'backfill_parallelism' parses successfully but exceeds CDC_BACKFILL_MAX_PARALLELISM, RisingWave rejects it with this range error. The value must be within [0, CDC_BACKFILL_MAX_PARALLELISM].

Solutions

  1. Lower backfill_parallelism to at most CDC_BACKFILL_MAX_PARALLELISM (check the constant in cdc_scan.rs).
  2. Remove the option to use the default parallelism.
  3. Use multiple tables/instances rather than one oversized parallelism value.

Example fix

// before
WITH (connector='cdc-mysql', backfill_parallelism = '100')
// after
WITH (connector='cdc-mysql', backfill_parallelism = '8')
Defensive patterns

Strategy: validation

Validate before calling

const MAX_BACKFILL_PARALLELISM = 16; // check CDC_BACKFILL_MAX_PARALLELISM in cdc_scan.rs
const n = Number(opts.backfill_parallelism);
if (opts.backfill_parallelism !== undefined && (!Number.isInteger(n) || n < 0 || n > MAX_BACKFILL_PARALLELISM)) {
  throw new Error(`backfill_parallelism must be in [0, ${MAX_BACKFILL_PARALLELISM}], got: ${n}`);
}

Type guard

const inRange = (n: number, max: number): boolean => Number.isInteger(n) && n >= 0 && n <= max;

Prevention

When it happens

Trigger: CREATE TABLE ... WITH (connector = 'cdc-...', backfill_parallelism = '100') where 100 > CDC_BACKFILL_MAX_PARALLELISM, with support_backfill_v2 true.

Common situations: Setting a very high parallelism hoping to speed up backfill; values tuned for other systems copied over.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

Thrown at src/frontend/src/optimizer/plan_node/generic/cdc_scan.rs:90

            .map_err(|_| anyhow!("Invalid value for {}", CDC_BACKFILL_ENABLE_KEY))?);
    };

    if let Some(snapshot_interval) = with_options.get(CDC_BACKFILL_SNAPSHOT_INTERVAL_KEY) {
        scan_options.snapshot_barrier_interval = u32::from_str(snapshot_interval)
            .map_err(|_| anyhow!("Invalid value for {}", CDC_BACKFILL_SNAPSHOT_INTERVAL_KEY))?;
    };

    if let Some(snapshot_batch_size) = with_options.get(CDC_BACKFILL_SNAPSHOT_BATCH_SIZE_KEY) {
        scan_options.snapshot_batch_size = u32::from_str(snapshot_batch_size)
            .map_err(|_| anyhow!("Invalid value for {}", CDC_BACKFILL_SNAPSHOT_BATCH_SIZE_KEY))?;
    };

    if support_backfill_v2 {
        if let Some(backfill_parallelism) = with_options.get(CDC_BACKFILL_PARALLELISM) {
            scan_options.backfill_parallelism = u32::from_str(backfill_parallelism)
                .map_err(|_| anyhow!("Invalid value for {}", CDC_BACKFILL_PARALLELISM))?;
            if scan_options.backfill_parallelism > CDC_BACKFILL_MAX_PARALLELISM {
                return Err(anyhow!(
                    "Invalid value for {}, should be in range [0,{}] ",
                    CDC_BACKFILL_PARALLELISM,
                    CDC_BACKFILL_MAX_PARALLELISM
                )
                .into());
            }
        }

        if let Some(backfill_num_rows_per_split) = with_options.get(CDC_BACKFILL_NUM_ROWS_PER_SPLIT)
        {
            scan_options.backfill_num_rows_per_split = u64::from_str(backfill_num_rows_per_split)
                .map_err(|_| {
                anyhow!("Invalid value for {}", CDC_BACKFILL_NUM_ROWS_PER_SPLIT)
            })?;
        }

        if let Some(backfill_as_even_splits) = with_options.get(CDC_BACKFILL_AS_EVEN_SPLITS) {
            scan_options.backfill_as_even_splits = bool::from_str(backfill_as_even_splits)

View on GitHub (pinned to 6469eb736d)