{"record":{"id":"e34366bb97abca88","repo":"apache/beam","slug":"pipeline-type-checking-is-enabled-however-no-output-type","errorCode":null,"errorMessage":"Pipeline type checking is enabled, however no output type-hint was found for the PTransform %s","messagePattern":"Pipeline type checking is enabled, however no output type-hint was found for the PTransform (.+?)","errorType":"exception","errorClass":"TypeCheckError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/pipeline.py","lineNumber":867,"sourceCode":"          transform.get_type_hints().output_types is None):\n        ptransform_name = '%s(%s)' % (transform.__class__.__name__, full_label)\n        raise TypeCheckError(\n            'Pipeline type checking is enabled, however no '\n            'output type-hint was found for the '\n            'PTransform %s' % ptransform_name)\n    finally:\n      self.transforms_stack.pop()\n    return pvalueish_result\n\n  def _assert_not_applying_PDone(\n      self,\n      pvalueish: Optional[pvalue.PValue],\n      transform: ptransform.PTransform):\n    if isinstance(pvalueish, pvalue.PDone) and isinstance(transform, ParDo):\n      # If the input is a PDone, we cannot apply a ParDo transform.\n      full_label = self._current_transform().full_label\n      producer_label = pvalueish.producer.full_label\n      raise TypeCheckError(\n          f'Transform \"{full_label}\" was applied to the output of '\n          f'\"{producer_label}\" but \"{producer_label.split(\"/\")[-1]}\" '\n          'produces no PCollections.')\n\n  def _generate_unique_label(self, transform: str) -> str:\n    \"\"\"\n    Given a transform, generate a unique label for it based on current label.\n    \"\"\"\n    unique_suffix = uuid.uuid4().hex[:6]\n    return '%s_%s' % (transform.label, unique_suffix)\n\n  def _infer_result_type(\n      self,\n      transform: ptransform.PTransform,\n      inputs: Sequence[Union[pvalue.PBegin, pvalue.PCollection]],\n      result_pcollection: Union[pvalue.PValue, pvalue.DoOutputsTuple]) -> None:\n    \"\"\"Infer and set the output element type for a PCollection.\n    ","sourceCodeStart":849,"sourceCodeEnd":885,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/pipeline.py#L849-L885","documentation":"Raised when pipeline type checking is enabled (type_check_strictness == 'ALL_REQUIRED') and a PTransform being applied has no output type hints. Beam requires every transform to declare its output types so it can validate pipeline data flow at graph-construction time.","triggerScenarios":"Running with --type_check_strictness=ALL_REQUIRED (or PipelineOptions type_check_strictness option) while applying a custom PTransform/DoFn whose output type hint (with_output_types) is missing.","commonSituations":"Custom DoFns or PTransforms written without @typehints decorators; upgrading Beam to stricter type checking defaults; third-party transforms lacking hints.","solutions":["Annotate the DoFn/expand with output type hints, e.g. @beam.typehints.with_output_types or expand returning pvalue.PCollection.with_output_types(...)","Relax strictness by setting type_check_strictness to 'DEFAULT' in PipelineOptions if hints cannot be added","Add @typehints decorators on process/expand methods to declare element types"],"exampleFix":"// before\nclass MyDoFn(beam.DoFn):\n    def process(self, element):\n        yield str(element)\n// after\nclass MyDoFn(beam.DoFn):\n    @beam.typehints.with_output_types(str)\n    def process(self, element):\n        yield str(element)","handlingStrategy":"validation","validationCode":"from apache_beam import typehints\nif typehints.decorator.get_type_hints(my_transform_fn).output_types is None:\n    raise ValueError('Transform lacks output type hints')","typeGuard":"from apache_beam.typehints import typehints\n\ndef has_output_hints(fn):\n    return typehints.native_type_compatibility.convert_to_beam_type is not None and getattr(fn, '_beam_type_hints_output', None) is not None","tryCatchPattern":"try:\n    result = pcoll | my_transform\nexcept apache_beam.TypeCheckError as e:\n    logging.warning('Missing type hints: %s — falling back to default strictness', e)","preventionTips":["Always annotate DoFn.process and PTransform.expand with typehints","Run pipelines with type checking in CI","Add @with_output_types to every custom transform"],"tags":["python","apache-beam","type-hints","typecheck"],"backgroundTag":"missing-required-config-field","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}