{"record":{"id":"44a39b5e0dba1073","repo":"apache/beam","slug":"unknown-event-type","errorCode":null,"errorMessage":"Unknown event type + ","messagePattern":"Unknown event type \\+ ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/testing/TestStream.java","lineNumber":387,"sourceCode":"        switch (eventType) {\n          case ELEMENT:\n            int numElements = VarIntCoder.of().decode(inStream);\n            List<TimestampedValue<T>> elements = new ArrayList<>(numElements);\n            for (int j = 0; j < numElements; j++) {\n              elements.add(elementCoder.decode(inStream));\n            }\n            events.add(ElementEvent.add(elements));\n            break;\n          case WATERMARK:\n            Instant watermark = InstantCoder.of().decode(inStream);\n            events.add(WatermarkEvent.advanceTo(watermark));\n            break;\n          case PROCESSING_TIME:\n            Duration duration = DurationCoder.of().decode(inStream).toDuration();\n            events.add(ProcessingTimeEvent.advanceBy(duration));\n            break;\n          default:\n            throw new IllegalStateException(\"Unknown event type + \" + eventType);\n        }\n      }\n      return TestStream.fromRawEvents(elementCoder.getValueCoder(), events);\n    }\n\n    @Override\n    public List<? extends Coder<?>> getCoderArguments() {\n      return Collections.singletonList(elementCoder);\n    }\n\n    @Override\n    public void verifyDeterministic() throws NonDeterministicException {}\n  }\n}\n","sourceCodeStart":369,"sourceCodeEnd":402,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/testing/TestStream.java#L369-L402","documentation":"TestStream's coder decode() throws IllegalStateException when it reads an eventType byte that is not one of the known enum values (ELEMENT, WATERMARK, PROCESSING_TIME). This guards wire-format corruption or version skew between encoder and decoder.","triggerScenarios":"Decoding a TestStream whose encoded event-type discriminant is outside the handled switch cases — typically a stream encoded by a newer/older Beam version with extra event types, or corrupted/incorrectly deserialized bytes.","commonSituations":"Pipelined data serialized with a different Beam version where TestStream.Encoding evolved; hand-crafted or truncated encoded TestStream data in tests.","solutions":["Decode the TestStream with the same Beam version that encoded it","Re-encode the TestStream after aligning SDK versions","Check the eventType value in the failure and map it to the enum to confirm corruption vs version skew"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  TestStream<?> stream = TestStream.CoderHub.decode(bytes);\n} catch (IllegalStateException e) {\n  if (e.getMessage().startsWith(\"Unknown event type\")) {\n    throw new IllegalStateException(\"TestStream bytes encoded with an incompatible Beam version\", e);\n  }\n  throw e;\n}","preventionTips":["Encode and decode TestStreams with the same Beam SDK version","Pin Beam SDK version across pipeline stages that serialize test data","Avoid hand-crafting TestStream encoded bytes"],"tags":["java","testing","deserialization","coder"],"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-20T03:17:13.778Z"}