{"record":{"id":"485f27ff3ac083d2","repo":"apache/beam","slug":"unrecognized-input-type-input","errorCode":null,"errorMessage":"Unrecognized input type: ${input}","messagePattern":"Unrecognized input type: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/yaml/src/main/java/org/apache/beam/sdk/extensions/yaml/YamlTransform.java","lineNumber":170,"sourceCode":"    }\n\n    // There is no generic apply...\n    POutput output;\n    @SuppressWarnings(\"rawtypes\")\n    PTransform externalTransform =\n        PythonExternalTransform.from(\"apache_beam.yaml.yaml_transform.YamlTransform\")\n            .withArgs(yamlDefinition)\n            .withExtraPackages(ImmutableList.of(\"jinja2\", \"pyyaml\", \"virtualenv-clone\"));\n    if (input instanceof PBegin) {\n      output = ((PBegin) input).apply(externalTransform);\n    } else if (input instanceof PCollection) {\n      output = ((PCollection<?>) input).apply(externalTransform);\n    } else if (input instanceof PCollection) {\n      output = ((PCollection<?>) input).apply(externalTransform);\n    } else if (input instanceof PCollectionRowTuple) {\n      output = ((PCollectionRowTuple) input).apply(externalTransform);\n    } else {\n      throw new IllegalArgumentException(\"Unrecognized input type: \" + input);\n    }\n\n    if (outputTags == null) {\n      if (!(output instanceof PCollection)) {\n        throw new IllegalArgumentException(\n            \"Expected a single PCollection output, but got \"\n                + output\n                + \". Perhaps withMultipleOutputs() needs to be specified?\");\n      }\n      return (OutputT) output;\n    } else {\n      if (output instanceof PCollection) {\n        // ExternalPythonTransform always returns single outputs as PCollections.\n        if (outputTags.size() != 1) {\n          throw new IllegalArgumentException(\n              \"Expected \" + outputTags.size() + \" outputs, but got exactly one.\");\n        }\n        return (OutputT)","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/yaml/src/main/java/org/apache/beam/sdk/extensions/yaml/YamlTransform.java#L152-L188","documentation":"YamlTransform.expand only knows how to feed an external transform from a PCollection or a PCollectionRowTuple. If the expand() input is any other PValue/PCollection type, the library cannot map it onto the external transform's input and throws IllegalArgumentException naming the object's type.","triggerScenarios":"Passing a PCollectionList, PCollectionTuple, or other PValue subtype as the input element of a YamlTransform in expand().","commonSituations":"Building multi-input pipelines where intermediate values are PCollectionList (e.g. from Flatten/Partition outputs) and mistakenly passing them to a YAML transform; refactorings that change input types.","solutions":["Convert the input to a PCollection or PCollectionRowTuple before applying the YamlTransform.","If the input is a PCollectionList, flatten or index it into a single PCollection first.","Use a standard (non-YAML) transform if you genuinely need exotic input types.","Check the message's printed object for the concrete class and adjust the pipeline shape accordingly."],"exampleFix":"// before\nPCollectionList pcs = ...; pipeline.apply(yamlTransform, pcs);\n// after\npcs.get(0).apply(yamlTransform);","handlingStrategy":"type-guard","validationCode":"if (!(input instanceof PCollection) && !(input instanceof PCollectionRowTuple)) {\n  throw new IllegalArgumentException(\"YamlTransform requires PCollection or PCollectionRowTuple, got \" + input.getClass());\n}","typeGuard":"boolean isYamlTransformInput(PValue v) {\n  return v instanceof PCollection || v instanceof PCollectionRowTuple;\n}","tryCatchPattern":"try {\n  return yamlTransform.expand(input);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unrecognized input type\")) { /* convert input */ }\n  throw e;\n}","preventionTips":["Avoid PCollectionList/PCollectionTuple as YAML transform inputs","Flatten or index multi-PCollections before applying","Add pipeline-shape unit tests around YAML transform wiring"],"tags":["apache-beam","java","yaml-transform","type-mismatch"],"backgroundTag":"incompatible-source-type","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"}