{"record":{"id":"502da8c1430d575e","repo":"apache/beam","slug":"dofn-self-do-fn-r-has-unsupported-process-batch-method","errorCode":null,"errorMessage":"DoFn {self.do_fn!r} has unsupported process_batch method parameter {d}","messagePattern":"DoFn (.+?) has unsupported process_batch method parameter (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/common.py","lineNumber":374,"sourceCode":"\n      # Helpful errors for params which will be supported in the future\n      if d == (core.DoFn.ElementParam):\n        # We currently assume we can just get the typehint from the first\n        # parameter. ElementParam breaks this assumption\n        raise NotImplementedError(\n            f\"DoFn {self.do_fn!r} uses unsupported DoFn param ElementParam.\")\n\n      if d in (core.DoFn.KeyParam, core.DoFn.StateParam, core.DoFn.TimerParam):\n        raise NotImplementedError(\n            f\"DoFn {self.do_fn!r} has unsupported per-key DoFn param {d}. \"\n            \"Per-key DoFn params are not yet supported for process_batch \"\n            \"(https://github.com/apache/beam/issues/21653).\")\n\n      # Fallback to catch anything not explicitly supported\n      if not d in (core.DoFn.WindowParam,\n                   core.DoFn.TimestampParam,\n                   core.DoFn.PaneInfoParam):\n        raise ValueError(\n            f\"DoFn {self.do_fn!r} has unsupported process_batch \"\n            f\"method parameter {d}\")\n\n  def _validate_bundle_method(self, method_wrapper):\n    \"\"\"Validate that none of the DoFnParameters are used in the function\n    \"\"\"\n    for param in core.DoFn.DoFnProcessParams:\n      if param in method_wrapper.defaults:\n        raise ValueError(\n            'DoFn.process() method-only parameter %s cannot be used in %s.' %\n            (param, method_wrapper))\n\n  def _validate_stateful_dofn(self):\n    # type: () -> None\n    userstate.validate_stateful_dofn(self.do_fn)\n\n  def is_splittable_dofn(self):\n    # type: () -> bool","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/common.py#L356-L392","documentation":"The runner's DoFn signature introspection found a process_batch (or process_for_key_batch) parameter that batch-mode execution cannot supply yet (beyond the explicitly handled Element/Key/State/Timer cases); this NotImplementedError marks a not-yet-supported parameter as the SDK evolves.","triggerScenarios":"process_batch declaring any core.DoFn.* param outside {WindowParam, TimestampParam, PaneInfoParam} (and the explicitly rejected Element/Key/State/Timer ones), validated via _validate during invoker setup.","commonSituations":"Adding BundleFinalizerParam or a custom param to a batch method; typos producing a param object the whitelist doesn't recognize.","solutions":["Restrict process_batch parameters to elements plus Window/Timestamp/PaneInfo params","Move unsupported special-parameter usage into a regular process() DoFn","Check the exact param object types against apache_beam.transforms.core.DoFn definitions"],"exampleFix":"// before\ndef process_batch(self, els, fin=DoFn.BundleFinalizerParam):\n// after\ndef process_batch(self, els, w=DoFn.WindowParam):","handlingStrategy":"validation","validationCode":"ALLOWED = (DoFn.WindowParam, DoFn.TimestampParam, DoFn.PaneInfoParam)\nbad = [p for p in inspect.signature(MyDoFn.process_batch).values if p.default not in ALLOWED and isinstance(p.default, DoFn.DoFnParam)]\nassert not bad","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only Window/Timestamp/PaneInfo params in batch methods","Check against core.DoFn definitions when adding params"],"tags":["python","apache-beam","process-batch"],"backgroundTag":"invalid-argument-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"}