{"record":{"id":"9a62150d75afae3c","repo":"apache/beam","slug":"triggers-never-set-or-called-for-batch-default-windowing","errorCode":null,"errorMessage":"Triggers never set or called for batch default windowing.","messagePattern":"Triggers never set or called for batch default windowing\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/transforms/trigger.py","lineNumber":1354,"sourceCode":"      state,\n      windowed_values,\n      unused_output_watermark,\n      unused_input_watermark=MIN_TIMESTAMP):\n    yield WindowedValue(\n        _UnwindowedValues(windowed_values),\n        MIN_TIMESTAMP,\n        self.GLOBAL_WINDOW_TUPLE,\n        self.ONLY_FIRING)\n\n  def process_timer(\n      self,\n      window_id,\n      name,\n      time_domain,\n      timestamp,\n      state,\n      input_watermark=None):\n    raise TypeError('Triggers never set or called for batch default windowing.')\n\n\nclass CombiningTriggerDriver(TriggerDriver):\n  \"\"\"Uses a phased_combine_fn to process output of wrapped TriggerDriver.\"\"\"\n  def __init__(self, phased_combine_fn, underlying):\n    self.phased_combine_fn = phased_combine_fn\n    self.underlying = underlying\n\n  def process_elements(\n      self,\n      state,\n      windowed_values,\n      output_watermark,\n      input_watermark=MIN_TIMESTAMP):\n    uncombined = self.underlying.process_elements(\n        state, windowed_values, output_watermark, input_watermark)\n    for output in uncombined:\n      yield output.with_value(self.phased_combine_fn.apply(output.value))","sourceCodeStart":1336,"sourceCodeEnd":1372,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/transforms/trigger.py#L1336-L1372","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run the pipeline in streaming mode (e.g. --streaming with a supported runner) if triggers/timers are required.","Use non-default windowing (e.g. FixedWindows/SlidingWindows) when you need trigger semantics, even in batch.","Guard custom trigger code: skip timer setup when windowfn is the default GlobalWindows in batch mode."],"exampleFix":"// before\nstate.set_timer(window, name, TimeDomain.WATERMARK, ts)  # batch default windowing -> TypeError\n// after\nif streaming and not isinstance(windowfn, GlobalWindows):\n    state.set_timer(window, name, TimeDomain.WATERMARK, ts)","handlingStrategy":"validation","validationCode":"from apache_beam.transforms.window import GlobalWindows\nif not streaming and isinstance(pipeline_default_windowfn, GlobalWindows):\n    raise RuntimeError('Triggers/timers require streaming or non-default windowing')","typeGuard":"def triggers_supported(is_streaming, windowfn):\n    from apache_beam.transforms.window import GlobalWindows\n    return is_streaming or not isinstance(windowfn, GlobalWindows)","tryCatchPattern":"try:\n    state.set_timer(window, name, td, ts)\nexcept TypeError:\n    logger.warning('Timers unsupported in batch default windowing; deferring to EOB')","preventionTips":["Run with --streaming on a supporting runner when using triggers/timers.","Choose FixedWindows/SlidingWindows if you need trigger semantics in batch.","Gate trigger/timer code on windowfn.is_default() checks."],"tags":["python","apache-beam","trigger","batch","windowing"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}