apache/beam · warning

As a result, the data sequence will be repeated to generate…

Error message

{message} As a result, the data sequence will be repeated to generate elements for the entire duration.

What it means

PeriodicSequence validates that the provided data covers the requested [start, stop) duration. When the sequence's element timestamps do not extend to stop_timestamp and elements are not pre-timestamped, _validate_and_adjust_duration warns that the data will simply be repeated to keep emitting elements for the entire duration instead of raising (which happens when elements ARE pre-timestamped).

Solutions

  1. Provide more data elements so the sequence covers the full duration.
  2. Decrease stop_timestamp to match the amount of data provided.
  3. Ensure elements carry explicit (pre-)timestamps if you need exact end behavior — note that in that case a ValueError is raised instead of a warning.
  4. If repetition is the desired behavior, ignore the warning.

Example fix

# before
PeriodicSequence(['a', 'b'], stop_timestamp=Timestamp.now() + 3600)  # repeats
# after
PeriodicSequence(['a', 'b'], stop_timestamp=Timestamp.now() + 10)
Defensive patterns

Strategy: validation

Validate before calling

# Before building the sequence, ensure data covers the duration
n_elements = len(data)
required = (stop_timestamp - start_timestamp) / period
if n_elements * period < (stop_timestamp - start_timestamp):
    print('warning: not enough data for duration; elements will repeat')

Try / catch

import warnings
with warnings.catch_warnings(record=True) as w:
    warnings.simplefilter('always')
    seq = PeriodicSequence(data, period=..., stop_timestamp=stop)
    for warning in w:
        if 'repeated' in str(warning.message):
            print('data will repeat; add data or shorten stop_timestamp')

Prevention

When it happens

Trigger: Creating PeriodicSequence (or ImpulseSeqGen) with a stop_timestamp beyond the generated data's coverage without explicit per-element timestamps, so the source data is looped to fill the duration.

Common situations: Streaming test pipelines generating events from a finite list for a fixed test window; users supply fewer elements than the duration requires and are surprised by duplicated output.

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 apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/ca243f11de28012a. Report an issue: GitHub.

Appendix: source

Thrown at sdks/python/apache_beam/transforms/periodicsequence.py:289

      stop_ts = self.stop_ts

    # The total time for the impulse signal which occurs in [start, end).
    impulse_duration = stop_ts - start_ts
    if data_duration + Duration(self.interval) < impulse_duration:
      # We don't have enough data for the impulse.
      # If we can fit at least one more data point in the impulse duration,
      # then we will be in the repeat mode.
      message = 'The number of elements in the provided pre-timestamped ' \
        'data sequence is not enough to span the full impulse duration. ' \
        f'Expected duration: {impulse_duration}, ' \
        f'actual data duration: {data_duration}.'

      if is_pre_timestamped:
        raise ValueError(
            f'{message} Please either provide more data or decrease '
            '`stop_timestamp`.')
      else:
        warnings.warn(
            f'{message} As a result, the data sequence will be repeated to '
            'generate elements for the entire duration.')

  def __init__(
      self,
      start_timestamp: TimestampTypes = Timestamp.now(),
      stop_timestamp: TimestampTypes = MAX_TIMESTAMP,
      fire_interval: float = 360.0,
      apply_windowing: bool = False,
      data: Optional[Sequence[Any]] = None,
      rebase: RebaseMode = RebaseMode.REBASE_NONE):
    '''
    :param start_timestamp: Timestamp for first element.
    :param stop_timestamp: Timestamp at or after which no elements will be
      output.
    :param fire_interval: Interval in seconds at which to output elements.
    :param apply_windowing: Whether each element should be assigned to
      individual window. If false, all elements will reside in global window.

View on GitHub (pinned to 12126d8942)