apache/beam · error · TypeError

Triggers never set or called for batch default windowing.

Error message

Triggers never set or called for batch default windowing.

What it means

The batch default-windowing TriggerDriver raises TypeError('Triggers never set or called for batch default windowing.') in set_timer. Batch pipelines with the default GlobalWindows do not run triggers or timers; state simply accumulates and is emitted at end-of-bundle.

Solutions

  1. Run the pipeline in streaming mode (e.g. --streaming with a supported runner) if triggers/timers are required.
  2. Use non-default windowing (e.g. FixedWindows/SlidingWindows) when you need trigger semantics, even in batch.
  3. Guard custom trigger code: skip timer setup when windowfn is the default GlobalWindows in batch mode.

Example fix

// before
state.set_timer(window, name, TimeDomain.WATERMARK, ts)  # batch default windowing -> TypeError
// after
if streaming and not isinstance(windowfn, GlobalWindows):
    state.set_timer(window, name, TimeDomain.WATERMARK, ts)
Defensive patterns

Strategy: validation

Validate before calling

from apache_beam.transforms.window import GlobalWindows
if not streaming and isinstance(pipeline_default_windowfn, GlobalWindows):
    raise RuntimeError('Triggers/timers require streaming or non-default windowing')

Type guard

def triggers_supported(is_streaming, windowfn):
    from apache_beam.transforms.window import GlobalWindows
    return is_streaming or not isinstance(windowfn, GlobalWindows)

Try / catch

try:
    state.set_timer(window, name, td, ts)
except TypeError:
    logger.warning('Timers unsupported in batch default windowing; deferring to EOB')

Prevention

When it happens

Trigger: A pipeline path that attempts to set a timer while executing the batch (non-streaming) default windowing driver - i.e. trigger code calling set_timer under batch execution of the default windowing scheme.

Common situations: Running a pipeline designed for streaming (with triggers/timers) in batch mode via DirectRunner; code paths that don't check windowfn.is_default(); unit tests invoking trigger logic against batch drivers.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/9a62150d75afae3c. Report an issue: GitHub.

Appendix: source

Thrown at sdks/python/apache_beam/transforms/trigger.py:1354

      state,
      windowed_values,
      unused_output_watermark,
      unused_input_watermark=MIN_TIMESTAMP):
    yield WindowedValue(
        _UnwindowedValues(windowed_values),
        MIN_TIMESTAMP,
        self.GLOBAL_WINDOW_TUPLE,
        self.ONLY_FIRING)

  def process_timer(
      self,
      window_id,
      name,
      time_domain,
      timestamp,
      state,
      input_watermark=None):
    raise TypeError('Triggers never set or called for batch default windowing.')


class CombiningTriggerDriver(TriggerDriver):
  """Uses a phased_combine_fn to process output of wrapped TriggerDriver."""
  def __init__(self, phased_combine_fn, underlying):
    self.phased_combine_fn = phased_combine_fn
    self.underlying = underlying

  def process_elements(
      self,
      state,
      windowed_values,
      output_watermark,
      input_watermark=MIN_TIMESTAMP):
    uncombined = self.underlying.process_elements(
        state, windowed_values, output_watermark, input_watermark)
    for output in uncombined:
      yield output.with_value(self.phased_combine_fn.apply(output.value))

View on GitHub (pinned to 12126d8942)