{"record":{"id":"581718fd1c9a7bf2","repo":"apache/beam","slug":"unsupported-input-type-input-getclass","errorCode":null,"errorMessage":"Unsupported input type: {input.getClass()}","messagePattern":"Unsupported input type: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/managed/src/main/java/org/apache/beam/sdk/managed/Managed.java","lineNumber":271,"sourceCode":"\n    @VisibleForTesting\n    static PCollectionRowTuple resolveInput(PInput input) {\n      if (input instanceof PBegin) {\n        return PCollectionRowTuple.empty(input.getPipeline());\n      } else if (input instanceof PCollection) {\n        PCollection<?> inputCollection = (PCollection<?>) input;\n        Preconditions.checkArgument(\n            inputCollection.getCoder() instanceof RowCoder,\n            \"Input PCollection must contain Row elements with a set Schema \"\n                + \"(using .setRowSchema()). Instead, found collection %s with coder: %s.\",\n            inputCollection.getName(),\n            inputCollection.getCoder());\n        return PCollectionRowTuple.of(INPUT, (PCollection<Row>) inputCollection);\n      } else if (input instanceof PCollectionRowTuple) {\n        return (PCollectionRowTuple) input;\n      }\n\n      throw new IllegalArgumentException(\"Unsupported input type: \" + input.getClass());\n    }\n  }\n}\n","sourceCodeStart":253,"sourceCodeEnd":275,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/managed/src/main/java/org/apache/beam/sdk/managed/Managed.java#L253-L275","documentation":"Managed.resolveInput accepts either a PCollection or a PCollectionRowTuple and normalizes it into a PCollectionRowTuple. If the object passed to the managed transform's inputTuple/resolveInput is neither type, it throws this IllegalArgumentException naming the actual class. The managed API has no way to adapt that input shape.","triggerScenarios":"Applying a Managed transform (e.g. Managed.SQLSERVER, Managed.KAFKA) to an input that is not a PCollection<Row> or PCollectionRowTuple, e.g. a raw PCollection<String>, PCollection<KV>, or some other PTransform-style input.","commonSituations":"Developers coming from other Beam connectors pass a differently-typed PCollection (e.g. strings or JSON objects) directly into a managed sink/source expecting auto-conversion.","solutions":["Convert the input to PCollection<Row> with a schema (setSchema / Row.withSchema) before applying the managed transform.","If using a raw PCollection<Row>, simply pass it directly — it is supported.","Use PCollectionRowTuple.of(Managed.INPUT, rowCollection) when composing multiple inputs.","Check the managed transform's documentation for the required input type (Row-based)."],"exampleFix":"// before\npipeline.apply(Managed.write(Managed.SQLSERVER, config)).applyEvent(myStringPc);\n// after\nPCollection<Row> rows = myStringPc.apply(...parse...).apply(Rows.of(schema));\nmyStringPc.apply(Managed.write(Managed.SQLSERVER, config)); // applied to rows","handlingStrategy":"type-guard","validationCode":"if (!(input instanceof PCollection || input instanceof PCollectionRowTuple)) {\n  throw new IllegalArgumentException(\"Managed input must be PCollection<Row> or PCollectionRowTuple, got \" + input.getClass());\n}","typeGuard":"boolean isManagedInput(Object in) { return (in instanceof PCollection<?> pc && pc.getSchema() != null) || in instanceof PCollectionRowTuple; }","tryCatchPattern":"try { return pipeline.apply(Managed.read(Managed.ICEBERG, config)); } catch (IllegalArgumentException e) { throw new IllegalStateException(\"Check managed input type\", e); }","preventionTips":["Only feed Row-schema PCollections or PCollectionRowTuple to Managed transforms.","Call pc.setSchema(...) before applying managed sinks.","Read the Managed javadoc for input requirements per transform."],"tags":["java","apache-beam","managed-api","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-14T16:17:12.679Z"}