{"record":{"id":"84b8db7738bff816","repo":"apache/beam","slug":"unsupported-type-of-s-s","errorCode":null,"errorMessage":"Unsupported type of %s: %s","messagePattern":"Unsupported type of (.+?): (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/TestStreamTranslation.java","lineNumber":130,"sourceCode":"                        ((TestStream.ProcessingTimeEvent<T>) event)\n                            .getProcessingTimeAdvance()\n                            .getMillis()))\n            .build();\n\n      case ELEMENT:\n        RunnerApi.TestStreamPayload.Event.AddElements.Builder builder =\n            RunnerApi.TestStreamPayload.Event.AddElements.newBuilder();\n        for (TimestampedValue<T> element : ((TestStream.ElementEvent<T>) event).getElements()) {\n          builder.addElements(\n              RunnerApi.TestStreamPayload.TimestampedElement.newBuilder()\n                  .setTimestamp(element.getTimestamp().getMillis())\n                  .setEncodedElement(\n                      ByteString.copyFrom(\n                          CoderUtils.encodeToByteArray(coder, element.getValue()))));\n        }\n        return RunnerApi.TestStreamPayload.Event.newBuilder().setElementEvent(builder).build();\n      default:\n        throw new IllegalArgumentException(\n            String.format(\n                \"Unsupported type of %s: %s\",\n                TestStream.Event.class.getCanonicalName(), event.getType()));\n    }\n  }\n\n  static <T> TestStream.Event<T> eventFromProto(\n      RunnerApi.TestStreamPayload.Event protoEvent, Coder<T> coder) throws IOException {\n    switch (protoEvent.getEventCase()) {\n      case WATERMARK_EVENT:\n        return TestStream.WatermarkEvent.advanceTo(\n            new Instant(protoEvent.getWatermarkEvent().getNewWatermark()));\n      case PROCESSING_TIME_EVENT:\n        return TestStream.ProcessingTimeEvent.advanceBy(\n            Duration.millis(protoEvent.getProcessingTimeEvent().getAdvanceDuration()));\n      case ELEMENT_EVENT:\n        List<TimestampedValue<T>> decodedElements = new ArrayList<>();\n        for (RunnerApi.TestStreamPayload.TimestampedElement element :","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/TestStreamTranslation.java#L112-L148","documentation":"TestStreamTranslation.eventToProto converts a TestStream.Event into its RunnerApi proto representation via a switch over the event type. If the event's getType() is not one of the known element/processing-time/watermark types, no case matches and the default branch throws IllegalArgumentException with the unknown type.","triggerScenarios":"Translating a TestStream whose event is EVENT_NOT_SET or a type added in a newer Beam version than the translator supports, typically when converting a pipeline containing TestStream to a RunnerApi proto.","commonSituations":"Proto deserialization produced an unset/default event; running tests across mismatched Beam SDK versions where new event kinds exist but the translator predates them.","solutions":["Check the TestStream construction so every added event is a supported ElementEvent/ProcessingTimeEvent/WatermarkEvent","Rebuild against a Beam version whose eventToProto knows the event type","Inspect the event for null/corrupted payload before translation"],"exampleFix":"// before\nTestStream<Long> ts = TestStream.create(coder).addElements(1L).advanceWatermarkToInfinity();\n// ensure events are well-formed; avoid building events via raw protos with EVENT_NOT_SET\n// after\nTestStream<Long> ts = TestStream.create(coder)\n    .addElements(1L)\n    .advanceProcessingDuration(Duration.millis(10))\n    .advanceWatermarkToInfinity();","handlingStrategy":"validation","validationCode":"// Verify each event in the TestStream is a supported concrete type before translation:\nfor (TestStream.Event<?> e : testStream.getEvents()) {\n  boolean ok = e instanceof TestStream.ElementEvent\n      || e instanceof TestStream.ProcessingTimeEvent\n      || e instanceof TestStream.WatermarkEvent;\n  if (!ok) throw new IllegalStateException(\"Unsupported TestStream event: \" + e);\n}","typeGuard":null,"tryCatchPattern":"try { translateToProto(stream); } catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unsupported type of\")) { /* rebuild stream with known event types */ }\n  else throw e;\n}","preventionTips":["Build TestStreams only via TestStream.create(...).addElements/advanceProcessingDuration/advanceWatermarkTo API","Keep SDK and runner versions aligned so new event types are translatable"],"tags":["java","beam","teststream","translation","illegal-argument"],"backgroundTag":"invalid-enum-value","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"}