risingwavelabs/risingwave · error

event offset is too big, offset: {}

Error message

event offset is too big, offset: {}

What it means

When constructing a numeric sequence field generator, the event offset (a u64 row counter) must be convertible into the target numeric type `T`. If the offset exceeds what `T` can represent (e.g. offset > 127 for TINYINT), the conversion fails and this error is raised instead of silently wrapping.

Source

Thrown at src/common/src/field_generator/numeric.rs:134

    {
        let mut start = T::zero();
        let mut end = T::from(i16::MAX);

        if let Some(star_optiont) = star_option {
            start = star_optiont.parse::<T>()?;
        }
        if let Some(end_option) = end_option {
            end = end_option.parse::<T>()?;
        }

        assert!(start <= end);
        Ok(Self {
            start,
            end,
            offset,
            step,
            cur: T::try_from(event_offset).map_err(|_| {
                anyhow::anyhow!("event offset is too big, offset: {}", event_offset,)
            })?,
        })
    }

    fn generate(&mut self) -> serde_json::Value {
        let partition_result = self.start
            + T::try_from(self.offset).unwrap()
            + T::try_from(self.step).unwrap() * self.cur;
        let partition_result = if partition_result > self.end {
            None
        } else {
            Some(partition_result)
        };
        self.cur += T::one();
        json!(partition_result)
    }

    fn generate_datum(&mut self) -> Datum {

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Use a larger integer type (INT64) for sequence columns expected to see many rows.
  2. Constrain the datagen sequence with `max` so offsets stay within the type's range.
  3. Restart or recreate the source to reset the event offset if appropriate.
  4. If you own the code, widen `T` bounds or pre-clamp the offset before `try_from`.

Example fix

-- before
CREATE TABLE t (v TINYINT, ...) WITH (connector='datagen', fields='v', sequence.min='-128', sequence.max='127')  -- long runs overflow offset
-- after
CREATE TABLE t (v BIGINT, ...) WITH (connector='datagen', fields='v', sequence.max='1000000000')
Defensive patterns

Strategy: validation

Validate before calling

if event_offset > T::max_value_as_u64() { return Err("offset exceeds type range".into()); }

Try / catch

match T::try_from(event_offset) {
    Ok(v) => ...,
    Err(_) => return Err(anyhow!("choose a wider column type; offset {} overflows {:?}", event_offset, std::mem::size_of::<T>())),
}

Prevention

When it happens

Trigger: Creating a sequence-based numeric field generator via `NumericFieldGenerator`'s constructor with an `event_offset` larger than `T::try_from(event_offset)` can represent — e.g. datagen row counts beyond i8/i16 range for small integer columns.

Common situations: Long-running datagen sources on TINYINT/SMALLINT sequence columns where generated row count exceeds the type's max; explicit large `start`/`end` bounds; testing with very high offsets.

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