{"record":{"id":"7a431eadad66531c","repo":"apache/beam","slug":"transform-full-label-was-applied-to-the-output-of-an-object","errorCode":null,"errorMessage":"Transform \"{full_label}\" was applied to the output of an object of type None.","messagePattern":"Transform \"(.+?)\" was applied to the output of an object of type None\\.","errorType":"exception","errorClass":"TypeCheckError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/pipeline.py","lineNumber":770,"sourceCode":"            'updating a pipeline or reloading the job state. '\n            'This is not recommended for streaming jobs.')\n        unique_label = self._generate_unique_label(transform)\n        return self.apply(transform, pvalueish, unique_label)\n      else:\n        raise RuntimeError(\n            'A transform with label \"%s\" already exists in the pipeline. '\n            'To apply a transform with a specified label, write '\n            'pvalue | \"label\" >> transform or use the option '\n            '\"auto_unique_labels\" to automatically generate unique '\n            'transform labels. Note \"auto_unique_labels\" '\n            'could cause data loss when updating a pipeline or '\n            'reloading the job state. This is not recommended for '\n            'streaming jobs.' % full_label)\n    self.applied_labels.add(full_label)\n\n    if pvalueish is None:\n      full_label = self._current_transform().full_label\n      raise TypeCheckError(\n          f'Transform \"{full_label}\" was applied to the output of '\n          f'an object of type None.')\n\n    pvalueish, inputs = transform._extract_input_pvalues(pvalueish)\n    try:\n      if not isinstance(inputs, dict):\n        inputs = {str(ix): input for (ix, input) in enumerate(inputs)}\n    except TypeError:\n      raise NotImplementedError(\n          'Unable to extract PValue inputs from %s; either %s does not accept '\n          'inputs of this format, or it does not properly override '\n          '_extract_input_pvalues' % (pvalueish, transform))\n    for t, leaf_input in inputs.items():\n      if not isinstance(leaf_input, pvalue.PValue) or not isinstance(t, str):\n        raise NotImplementedError(\n            '%s does not properly override _extract_input_pvalues, '\n            'returned %s from %s' % (transform, inputs, pvalueish))\n","sourceCodeStart":752,"sourceCodeEnd":788,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/pipeline.py#L752-L788","documentation":"During _apply_internal, if the pvalueish input is None, Beam raises TypeCheckError stating the transform (by full label) was applied to the output of an object of type None. Transforms must consume PValue-derived inputs, and None indicates the previous step produced no value (often a failed/chained apply).","triggerScenarios":"Chaining like pipeline | beam.Map(...) where the left side returned None; assigning result = some_operation that returns None and then passing it to a transform; calling a transform on a function that forgot to return a PCollection.","commonSituations":"Misordered arguments to pipeline.apply (label/pvalueish swapped so pvalueish ends up None); helper functions that build pipelines but return nothing; PTransforms whose expand doesn't return the output.","solutions":["Inspect the expression producing the input; it returned None — fix the producer to return a PCollection.","Check pipeline.apply argument order: apply(transform, pvalueish, label).","Ensure your helper/composite transform's expand() returns the resulting PCollection.","Verify each `|` chain starts from a Pipeline/PBegin/PCollection, not the result of an in-place operation."],"exampleFix":"// before\ndef build(p):\n  p | 'step' >> beam.Map(str)  # returns None\nout = build(pipeline) | beam.Map(len)\n// after\ndef build(p):\n  return p | 'step' >> beam.Map(str)\nout = build(pipeline) | beam.Map(len)","handlingStrategy":"type-guard","validationCode":"from apache_beam.pvalue import PValue\nassert input_pvalue is not None and isinstance(input_pvalue, PValue), 'transform input is None'","typeGuard":"from apache_beam.pvalue import PValue\ndef is_pvalue_input(x) -> bool:\n    return isinstance(x, PValue)","tryCatchPattern":"try:\n    result = transform_applier.apply(ptransform, pvalueish)\nexcept TypeCheckError as e:\n    if 'object of type None' in str(e):\n        raise ValueError('upstream step returned None; check its return value') from e","preventionTips":["Ensure helper functions building pipelines return the PCollection","Verify expand() returns its output","Check apply() argument order","Chain | off PCollections, never off in-place operations"],"tags":["python","apache-beam","type-check","null-input"],"backgroundTag":"null-argument","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}