{"record":{"id":"16b996d34354d34a","repo":"apache/beam","slug":"s-requires-a-pipeline-to-be-specified-as-there-are-no","errorCode":null,"errorMessage":"\"%s\" requires a pipeline to be specified as there are no deferred inputs.","messagePattern":"\"(.+?)\" requires a pipeline to be specified as there are no deferred inputs\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/transforms/ptransform.py","lineNumber":618,"sourceCode":"    \"\"\"Used to apply this PTransform to non-PValues, e.g., a tuple.\"\"\"\n    pvalueish, pvalues = self._extract_input_pvalues(left)\n    if isinstance(pvalues, dict):\n      pvalues = tuple(pvalues.values())\n    pipelines = [v.pipeline for v in pvalues if isinstance(v, pvalue.PValue)]\n    if pvalues and not pipelines:\n      deferred = False\n      # pylint: disable=wrong-import-order, wrong-import-position\n      from apache_beam import pipeline\n      from apache_beam.options.pipeline_options import PipelineOptions\n\n      # pylint: enable=wrong-import-order, wrong-import-position\n      p = pipeline.Pipeline('DirectRunner', PipelineOptions(sys.argv))\n    else:\n      if not pipelines:\n        if self.pipeline is not None:\n          p = self.pipeline\n        else:\n          raise ValueError(\n              '\"%s\" requires a pipeline to be specified '\n              'as there are no deferred inputs.' % self.label)\n      else:\n        p = self.pipeline or pipelines[0]\n        for pp in pipelines:\n          if p != pp:\n            raise ValueError(\n                'Mixing values in different pipelines is not allowed.'\n                '\\n{%r} != {%r}' % (p, pp))\n      deferred = not getattr(p.runner, 'is_eager', False)\n    # pylint: disable=wrong-import-order, wrong-import-position\n    from apache_beam.transforms.core import Create\n\n    # pylint: enable=wrong-import-order, wrong-import-position\n    replacements = {\n        id(v): p | 'CreatePInput%s' % ix >> Create(v, reshuffle=False)\n        for (ix, v) in enumerate(pvalues)\n        if not isinstance(v, pvalue.PValue) and v is not None","sourceCodeStart":600,"sourceCodeEnd":636,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/transforms/ptransform.py#L600-L636","documentation":"When applying a PTransform via | on values that have no deferred inputs (no PCollections), Beam needs a pipeline context to build the transform. If no pipeline was passed, self.pipeline is None, and no pipelines were inferred, ValueError is raised asking for an explicit pipeline.","triggerScenarios":"Applying a transform to a plain value (e.g. beam.Create-like usage via __ror__ with non-PCollection inputs) without a pipeline argument and without self.pipeline set.","commonSituations":"Calling ptransform | value outside a with-beam.Pipeline block; using eager standalone transforms without supplying a Pipeline.","solutions":["Apply the transform within a `with beam.Pipeline() as p:` context and pass pipeline-aware inputs (e.g. p | transform).","Pass the pipeline explicitly (transform.with_pipeline(p) or apply via pipeline.apply).","Set the transform's pipeline attribute before application if used standalone.","Use beam.Create inside a pipeline scope for constant inputs."],"exampleFix":"// before\nresult = beam.Map(lambda x: x + 1) | 5  # no pipeline\n// after\nwith beam.Pipeline() as p:\n  result = p | beam.Create([5]) | beam.Map(lambda x: x + 1)","handlingStrategy":"try-catch","validationCode":"assert 'pipeline' in dir() or pipeline is not None, \"provide a pipeline when applying transform to non-deferred input\"","typeGuard":null,"tryCatchPattern":"try:\n  result = transform | value\nexcept ValueError as e:\n  if 'requires a pipeline' in str(e):\n    with beam.Pipeline() as p:\n      result = p | beam.Create([value]) | transform\n  else:\n    raise","preventionTips":["Always apply transforms inside `with beam.Pipeline()` scope","Use beam.Create for plain Python values"],"tags":["python","apache-beam","pipeline"],"backgroundTag":"missing-required-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"}