{"record":{"id":"cc627e60874ee687","repo":"apache/beam","slug":"unknown-s-type-s","errorCode":null,"errorMessage":"Unknown %s type %s","messagePattern":"Unknown (.+?) type (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/ReadTranslation.java","lineNumber":75,"sourceCode":"        .setIsBounded(IsBounded.Enum.BOUNDED)\n        .setSource(toProto(read.getSource()))\n        .build();\n  }\n\n  public static ReadPayload toProto(SplittableParDo.PrimitiveUnboundedRead<?> read) {\n    return ReadPayload.newBuilder()\n        .setIsBounded(IsBounded.Enum.UNBOUNDED)\n        .setSource(toProto(read.getSource()))\n        .build();\n  }\n\n  public static FunctionSpec toProto(Source<?> source) {\n    if (source instanceof BoundedSource) {\n      return toProto((BoundedSource) source);\n    } else if (source instanceof UnboundedSource) {\n      return toProto((UnboundedSource<?, ?>) source);\n    } else {\n      throw new IllegalArgumentException(\n          String.format(\"Unknown %s type %s\", Source.class.getSimpleName(), source.getClass()));\n    }\n  }\n\n  private static FunctionSpec toProto(BoundedSource<?> source) {\n    return FunctionSpec.newBuilder()\n        .setUrn(JAVA_SERIALIZED_BOUNDED_SOURCE)\n        .setPayload(ByteString.copyFrom(SerializableUtils.serializeToByteArray(source)))\n        .build();\n  }\n\n  public static BoundedSource<?> boundedSourceFromProto(ReadPayload payload)\n      throws InvalidProtocolBufferException {\n    checkArgument(payload.getIsBounded().equals(IsBounded.Enum.BOUNDED));\n    return (BoundedSource<?>)\n        SerializableUtils.deserializeFromByteArray(\n            payload.getSource().getPayload().toByteArray(), \"BoundedSource\");\n  }","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/ReadTranslation.java#L57-L93","documentation":"ReadTranslation.toProto(Source<?>) converts an org.apache.beam.sdk.io.Source into its protobuf FunctionSpec representation. Only BoundedSource and UnboundedSource subclasses are supported; any other Source implementation triggers an IllegalArgumentException with 'Unknown Source type <class>'. It exists because the wire protocol only defines payload translators for those two source kinds.","triggerScenarios":"Calling ReadTranslation.toProto(source) with a Source that is neither a BoundedSource nor an UnboundedSource — e.g. a custom Source subclass that directly extends Source, or a Source returned by a third-party connector.","commonSituations":"Custom IO connectors written against the abstract Source base class instead of BoundedSource/UnboundedSource, using legacy non-splittable sources with runners that translate pipelines to proto, or version changes where a source class no longer extends the expected type.","solutions":["Make the custom source extend BoundedSource (or UnboundedSource) instead of raw Source.","Use a built-in Beam connector (e.g. the newer splittable DoFn-based APIs) that supports proto translation.","If you own the translation path, register a payload translator for the custom source type.","Check the concrete class in the message and confirm which interface it implements."],"exampleFix":"// before\nclass MySource extends Source<String> { ... }\n// after\nclass MySource extends BoundedSource<String> {\n  @Override public Coder<String> getOutputCoder() { ... }\n  @Override public List<? extends BoundedSource<String>> split(long desiredBundleSizeBytes, PipelineOptions options) { ... }\n}","handlingStrategy":"type-guard","validationCode":"if (!(source instanceof BoundedSource) && !(source instanceof UnboundedSource)) { throw new IllegalArgumentException(\"Unsupported source: \" + source.getClass()); }","typeGuard":"boolean isTranslatable(Source<?> s) { return s instanceof BoundedSource || s instanceof UnboundedSource; }","tryCatchPattern":"try { FunctionSpec spec = ReadTranslation.toProto(source); } catch (IllegalArgumentException e) { /* route to custom translator */ }","preventionTips":["Extend BoundedSource/UnboundedSource, never raw Source","Unit-test proto translation of custom sources","Register payload translators for custom source types"],"tags":["java","beam","io","source","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-14T21:17:11.552Z"}