{"record":{"id":"91c1253fb984bb27","repo":"risingwavelabs/risingwave","slug":"invalid-value-for-should-be-in-range-0","errorCode":null,"errorMessage":"Invalid value for {}, should be in range [0,{}] ","messagePattern":"Invalid value for (.+?), should be in range \\[0,(.+?)\\] ","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/frontend/src/optimizer/plan_node/generic/cdc_scan.rs","lineNumber":90,"sourceCode":"            .map_err(|_| anyhow!(\"Invalid value for {}\", CDC_BACKFILL_ENABLE_KEY))?);\n    };\n\n    if let Some(snapshot_interval) = with_options.get(CDC_BACKFILL_SNAPSHOT_INTERVAL_KEY) {\n        scan_options.snapshot_barrier_interval = u32::from_str(snapshot_interval)\n            .map_err(|_| anyhow!(\"Invalid value for {}\", CDC_BACKFILL_SNAPSHOT_INTERVAL_KEY))?;\n    };\n\n    if let Some(snapshot_batch_size) = with_options.get(CDC_BACKFILL_SNAPSHOT_BATCH_SIZE_KEY) {\n        scan_options.snapshot_batch_size = u32::from_str(snapshot_batch_size)\n            .map_err(|_| anyhow!(\"Invalid value for {}\", CDC_BACKFILL_SNAPSHOT_BATCH_SIZE_KEY))?;\n    };\n\n    if support_backfill_v2 {\n        if let Some(backfill_parallelism) = with_options.get(CDC_BACKFILL_PARALLELISM) {\n            scan_options.backfill_parallelism = u32::from_str(backfill_parallelism)\n                .map_err(|_| anyhow!(\"Invalid value for {}\", CDC_BACKFILL_PARALLELISM))?;\n            if scan_options.backfill_parallelism > CDC_BACKFILL_MAX_PARALLELISM {\n                return Err(anyhow!(\n                    \"Invalid value for {}, should be in range [0,{}] \",\n                    CDC_BACKFILL_PARALLELISM,\n                    CDC_BACKFILL_MAX_PARALLELISM\n                )\n                .into());\n            }\n        }\n\n        if let Some(backfill_num_rows_per_split) = with_options.get(CDC_BACKFILL_NUM_ROWS_PER_SPLIT)\n        {\n            scan_options.backfill_num_rows_per_split = u64::from_str(backfill_num_rows_per_split)\n                .map_err(|_| {\n                anyhow!(\"Invalid value for {}\", CDC_BACKFILL_NUM_ROWS_PER_SPLIT)\n            })?;\n        }\n\n        if let Some(backfill_as_even_splits) = with_options.get(CDC_BACKFILL_AS_EVEN_SPLITS) {\n            scan_options.backfill_as_even_splits = bool::from_str(backfill_as_even_splits)","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/frontend/src/optimizer/plan_node/generic/cdc_scan.rs#L72-L108","documentation":"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].","triggerScenarios":"CREATE TABLE ... WITH (connector = 'cdc-...', backfill_parallelism = '100') where 100 > CDC_BACKFILL_MAX_PARALLELISM, with support_backfill_v2 true.","commonSituations":"Setting a very high parallelism hoping to speed up backfill; values tuned for other systems copied over.","solutions":["Lower backfill_parallelism to at most CDC_BACKFILL_MAX_PARALLELISM (check the constant in cdc_scan.rs).","Remove the option to use the default parallelism.","Use multiple tables/instances rather than one oversized parallelism value."],"exampleFix":"// before\nWITH (connector='cdc-mysql', backfill_parallelism = '100')\n// after\nWITH (connector='cdc-mysql', backfill_parallelism = '8')","handlingStrategy":"validation","validationCode":"const MAX_BACKFILL_PARALLELISM = 16; // check CDC_BACKFILL_MAX_PARALLELISM in cdc_scan.rs\nconst n = Number(opts.backfill_parallelism);\nif (opts.backfill_parallelism !== undefined && (!Number.isInteger(n) || n < 0 || n > MAX_BACKFILL_PARALLELISM)) {\n  throw new Error(`backfill_parallelism must be in [0, ${MAX_BACKFILL_PARALLELISM}], got: ${n}`);\n}","typeGuard":"const inRange = (n: number, max: number): boolean => Number.isInteger(n) && n >= 0 && n <= max;","tryCatchPattern":null,"preventionTips":["Encode CDC_BACKFILL_MAX_PARALLELISM as a constant in client tooling.","Clamp user-supplied parallelism instead of passing it through.","Check the current limit constant when upgrading RisingWave versions."],"tags":["risingwave","sql","cdc","out-of-range"],"backgroundTag":"value-out-of-range","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}