{"record":{"id":"9d3b99e31745526e","repo":"apache/beam","slug":"dofn-watermarkestimatorparam","errorCode":null,"errorMessage":"DoFn.WatermarkEstimatorParam expectedWatermarkEstimatorProvider object.","messagePattern":"DoFn\\.WatermarkEstimatorParam expectedWatermarkEstimatorProvider object\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/transforms/core.py","lineNumber":526,"sourceCode":"\n  def has_callbacks(self):\n    # type: () -> bool\n    return len(self._callbacks) > 0\n\n  def reset(self):\n    # type: () -> None\n    del self._callbacks[:]\n\n\nclass _WatermarkEstimatorParam(_DoFnParam):\n  \"\"\"WatermarkEstimator DoFn parameter.\"\"\"\n  def __init__(\n      self,\n      watermark_estimator_provider: typing.\n      Optional[WatermarkEstimatorProvider] = None):\n    if (watermark_estimator_provider is not None and not isinstance(\n        watermark_estimator_provider, WatermarkEstimatorProvider)):\n      raise ValueError(\n          'DoFn.WatermarkEstimatorParam expected'\n          'WatermarkEstimatorProvider object.')\n    self.watermark_estimator_provider = watermark_estimator_provider\n    self.param_id = 'WatermarkEstimatorProvider'\n\n\nclass _ContextParam(_DoFnParam):\n  def __init__(\n      self, context_manager_constructor, args=(), kwargs=None, *, name=None):\n    class_name = self.__class__.__name__.strip('_')\n    if (not callable(context_manager_constructor) or\n        (hasattr(context_manager_constructor, '__enter__') and\n         len(inspect.signature(\n             context_manager_constructor.__enter__).parameters) == 0)):\n      # Context managers constructed with @contextlib.contextmanager can only\n      # be used once, and in addition cannot be pickled because they invoke\n      # the function on __init__ rather than at __enter__.\n      # In addition, other common context managers such as","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/transforms/core.py#L508-L544","documentation":"ValueError raised by `_WatermarkDoFnParam.__init__` (exposed as `DoFn.WatermarkEstimatorParam`) when the supplied watermark_estimator_provider is not `None` and is not an instance of `WatermarkEstimatorProvider`. Only a provider instance (or None) is accepted for watermark estimator parameters.","triggerScenarios":"Writing `DoFn.WatermarkEstimatorParam(MyEstimator)` or passing a class, callable, or estimator function instead of an object implementing `WatermarkEstimatorProvider` when declaring a DoFn with custom watermark estimation.","commonSituations":"Passing a watermark estimator factory function instead of a provider wrapping it; passing the class rather than an instance; confusion with `WatermarkEstimatorParam` expecting `WatermarkEstimatorProvider` (note the missing space in the message is cosmetic).","solutions":["Pass an instance of a class subclassing `WatermarkEstimatorProvider`, or use the built-in `WatermarkEstimatorParam(lambda state: WatermarkEstimator(...))`-style helper that wraps a callable in a provider.","Pass `None` if no custom estimator is needed.","Ensure an instance (not the class) is passed."],"exampleFix":"// before\nparam = DoFn.WatermarkEstimatorParam(MyWatermarkEstimator)  # class, not provider\n// after\nparam = DoFn.WatermarkEstimatorParam(MyWatermarkEstimatorProvider())  # WatermarkEstimatorProvider instance","handlingStrategy":"type-guard","validationCode":"from apache_beam.transforms.core import WatermarkEstimatorProvider\nif provider is not None and not isinstance(provider, WatermarkEstimatorProvider):\n    raise TypeError('expected WatermarkEstimatorProvider instance')","typeGuard":"from apache_beam.transforms.core import WatermarkEstimatorProvider\ndef is_watermark_provider(x) -> bool:\n    return x is None or isinstance(x, WatermarkEstimatorProvider)","tryCatchPattern":"try:\n    param = DoFn.WatermarkEstimatorParam(provider)\nexcept ValueError as e:\n    if 'WatermarkEstimatorProvider' in str(e):\n        provider = provider() if isinstance(provider, type) else None","preventionTips":["Subclass WatermarkEstimatorProvider rather than passing bare estimator functions or classes","Pass None when no custom estimator is needed","Double-check instance vs class when wiring DoFn params"],"tags":["apache-beam","dofn","watermark","type-check"],"backgroundTag":"type-mismatch","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"}