{"record":{"id":"4ab2cad9ede21eb0","repo":"apache/beam","slug":"s-does-not-support-non-zero-terminator-values-received","errorCode":null,"errorMessage":"%s does not support non zero terminator values. Received stream with terminator %s.","messagePattern":"(.+?) does not support non zero terminator values\\. Received stream with terminator (.+?)\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/coders/IterableLikeCoder.java","lineNumber":80,"sourceCode":"  }\n\n  /**\n   * Builds an instance of {@code IterableT}, this coder's associated {@link Iterable}-like subtype,\n   * from a list of decoded elements.\n   *\n   * <p>Override {@link #decodeToIterable(List, long, InputStream)} if you need access to the\n   * terminator value and the {@link InputStream}.\n   */\n  protected abstract IterableT decodeToIterable(List<T> decodedElements);\n\n  /**\n   * Builds an instance of {@code IterableT}, this coder's associated {@link Iterable}-like subtype,\n   * from a list of decoded elements with the {@link InputStream} at the position where this coder\n   * detected the end of the stream.\n   */\n  protected IterableT decodeToIterable(\n      List<T> decodedElements, long terminatorValue, InputStream in) throws IOException {\n    throw new IllegalStateException(\n        String.format(\n            \"%s does not support non zero terminator values. Received stream with terminator %s.\",\n            iterableName, terminatorValue));\n  }\n\n  /////////////////////////////////////////////////////////////////////////////\n  // Internal operations below here.\n\n  private final Coder<T> elementCoder;\n  private final String iterableName;\n\n  protected IterableLikeCoder(Coder<T> elementCoder, String iterableName) {\n    checkArgument(elementCoder != null, \"element Coder for IterableLikeCoder must not be null\");\n    checkArgument(iterableName != null, \"iterable name for IterableLikeCoder must not be null\");\n    this.elementCoder = elementCoder;\n    this.iterableName = iterableName;\n  }\n","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/coders/IterableLikeCoder.java#L62-L98","documentation":"IterableLikeCoder.decodeToIterable() is the extension hook for subclasses (ListCoder, IterableCoder, SetCoder, etc.). The base implementation throws IllegalStateException when the decoded stream carries a non-zero terminator, meaning the encoded stream was produced by an encoding scheme this coder does not understand. In practice this indicates byte-stream corruption or a coder mismatch between writer and reader.","triggerScenarios":"Decoding bytes with IterableLikeCoder (or a subclass) whose encoded stream ends with a non-zero terminator value; typically reading data encoded with a different or newer coder version, or reading from a truncated/corrupted source.","commonSituations":"Version-skew between job writer and runner (e.g. streaming pipelines upgraded mid-flight); manually concatenated encoded streams; implementing a custom IterableLikeCoder subclass without overriding decodeToIterable while emitting non-zero terminators.","solutions":["Ensure the same coder version encodes and decodes the data (pin Beam versions across write/read stages; drain or reset state when upgrading streaming jobs).","If you subclass IterableLikeCoder and intentionally emit non-zero terminators, override decodeToIterable(List, long, InputStream) to handle them.","Verify the encoded byte source is not truncated or corrupted; re-encode the data."],"exampleFix":"// before (custom coder emits terminator but doesn't handle it)\n// IllegalStateException at decode time\n// after\n@Override\nprotected IterableT decodeToIterable(List<T> decodedElements, long terminatorValue, InputStream in) {\n  if (terminatorValue == EXPECTED_TERMINATOR) return build(decodedElements);\n  throw new IllegalStateException(\"unexpected terminator \" + terminatorValue);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { coder.decode(in, context); } catch (IllegalStateException e) { log.error(\"Coder mismatch or corrupt stream\", e); throw new IOException(\"Undecodable iterable stream\", e); }","preventionTips":["Pin identical Beam versions on all writers and readers of encoded data.","Drain or reset streaming state on upgrades that change coder formats.","Do not hand-concatenate independently encoded coder streams."],"tags":["java","apache-beam","coders","decoding","stream-corruption"],"backgroundTag":"unsupported-operation","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"}