{"record":{"id":"29aaebbb7f6ed7bf","repo":"apache/beam","slug":"unsupported-merging-strategy-s","errorCode":null,"errorMessage":"Unsupported merging strategy: %s","messagePattern":"Unsupported merging strategy: (.+?)","errorType":"validation","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/portability/fn_api_runner/execution.py","lineNumber":901,"sourceCode":"    if windowing_strategy_proto.window_fn.urn in SAFE_WINDOW_FNS:\n      return id\n    else:\n      safe_id = id + '_safe'\n      while safe_id in self.pipeline_components.windowing_strategies:\n        safe_id += '_'\n      safe_proto = copy.copy(windowing_strategy_proto)\n      if (windowing_strategy_proto.merge_status ==\n          beam_runner_api_pb2.MergeStatus.NON_MERGING):\n        safe_proto.window_fn.urn = GenericNonMergingWindowFn.URN\n        safe_proto.window_fn.payload = (\n            windowing_strategy_proto.window_coder_id.encode('utf-8'))\n      elif (windowing_strategy_proto.merge_status ==\n            beam_runner_api_pb2.MergeStatus.NEEDS_MERGE):\n        window_fn = GenericMergingWindowFn(self, windowing_strategy_proto)\n        safe_proto.window_fn.urn = GenericMergingWindowFn.URN\n        safe_proto.window_fn.payload = window_fn.payload()\n      else:\n        raise NotImplementedError(\n            'Unsupported merging strategy: %s' %\n            windowing_strategy_proto.merge_status)\n      self.pipeline_context.windowing_strategies.put_proto(safe_id, safe_proto)\n      return safe_id\n\n  @property\n  def state_servicer(self) -> 'worker_handlers.StateServicer':\n    # TODO(BEAM-9625): Ensure FnApiRunnerExecutionContext owns StateServicer\n    return self.worker_handler_manager.state_servicer\n\n  def next_uid(self) -> str:\n    self._last_uid += 1\n    return str(self._last_uid)\n\n  def _iterable_state_write(\n      self, values: Iterable, element_coder_impl: CoderImpl) -> bytes:\n    token = unique_name(None, 'iter').encode('ascii')\n    out = create_OutputStream()","sourceCodeStart":883,"sourceCodeEnd":919,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/portability/fn_api_runner/execution.py#L883-L919","documentation":"Raised by _make_safe_windowing_strategy when a windowing strategy's merge_status is neither NON_MERGING nor NEEDS_MERGE. The fn-api runner can only wrap merging windows with GenericMergingWindowFn; any other merge status (e.g. UNSPECIFIED or an unknown proto value) is unsupported.","triggerScenarios":"Building a FnApiRunner stage whose windowing strategy proto has a merge_status value outside the two supported ones — typically an uninitialized strategy proto or a newer proto enum value the runner doesn't know.","commonSituations":"Custom windowing with an incompletely populated WindowingStrategy proto; pipelines built programmatically skipping windowing strategy defaults; proto version drift adding new MergeStatus values.","solutions":["Ensure the windowing strategy proto has merge_status explicitly set (NON_MERGING or NEEDS_MERGE)","Use standard window functions (Fixed/Sliding/SessionWindows) so merge_status is set by the framework","Upgrade apache-beam if your pipeline uses a MergeStatus value added after your runner version","Inspect the WindowingStrategy proto (e.g. via pipeline.to_runner_api()) to see the offending merge_status"],"exampleFix":"// before\nproto = beam_runner_api_pb2.WindowingStrategy()  # merge_status unset\n// after\nproto = beam_runner_api_pb2.WindowingStrategy(merge_status=beam_runner_api_pb2.MergeStatus.NEEDS_MERGE)\n","handlingStrategy":"validation","validationCode":"ws = pipeline_proto.components.windowing_strategies[wid]\nassert ws.merge_status in (MergeStatus.NON_MERGING, MergeStatus.NEEDS_MERGE), ws.merge_status","typeGuard":"def has_supported_merge_status(ws) -> bool:\n    return ws.merge_status in (beam_runner_api_pb2.MergeStatus.NON_MERGING,\n                               beam_runner_api_pb2.MergeStatus.NEEDS_MERGE)","tryCatchPattern":"try:\n    stage = translations.create_and_optimize_stages(proto, ...)\nexcept NotImplementedError as e:\n    if 'Unsupported merging strategy' in str(e):\n        fix_windowing_strategy(pipeline)\n    raise","preventionTips":["Use standard beam.transforms.window windowings","Never hand-build WindowingStrategy protos without setting merge_status","Keep proto enums and runner versions in sync"],"tags":["python","apache-beam","windows","windowing-strategy"],"backgroundTag":"unsupported-enum-value","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"}