{"record":{"id":"2a27ee4a506ad715","repo":"apache/iceberg","slug":"unsupported-version-version","errorCode":null,"errorMessage":"Unsupported version: {version}","messagePattern":"Unsupported version: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/source/split/IcebergSourceSplit.java","lineNumber":179,"sourceCode":"\n      serializedBytesCache = out.getCopyOfBuffer();\n      out.clear();\n    }\n\n    return serializedBytesCache;\n  }\n\n  private static void writeTaskJson(DataOutputSerializer out, String taskJson, int version)\n      throws IOException {\n    switch (version) {\n      case 2:\n        out.writeUTF(taskJson);\n        break;\n      case 3:\n        SerializerHelper.writeLongUTF(out, taskJson);\n        break;\n      default:\n        throw new IllegalArgumentException(\"Unsupported version: \" + version);\n    }\n  }\n\n  static IcebergSourceSplit deserializeV2(byte[] serialized, boolean caseSensitive)\n      throws IOException {\n    return deserialize(serialized, caseSensitive, 2);\n  }\n\n  static IcebergSourceSplit deserializeV3(byte[] serialized, boolean caseSensitive)\n      throws IOException {\n    return deserialize(serialized, caseSensitive, 3);\n  }\n\n  private static IcebergSourceSplit deserialize(\n      byte[] serialized, boolean caseSensitive, int version) throws IOException {\n    DataInputDeserializer in = new DataInputDeserializer(serialized);\n    int fileOffset = in.readInt();\n    long recordOffset = in.readLong();","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/source/split/IcebergSourceSplit.java#L161-L197","documentation":"IcebergSourceSplit.writeTaskJson serializes the embedded scan-task JSON with a per-version encoding (2: writeUTF, 3: SerializerHelper.writeLongUTF for strings longer than 64KB); any other version is rejected with IllegalArgumentException. It is an internal format guard on the split's binary layout.","triggerScenarios":"serialize() is called with a version other than 2 or 3 — only possible from code paths passing a hard-coded unsupported version, or a caller invoking internal serialization with a hand-chosen version.","commonSituations":"Custom code or tests calling the internal serialize/writeTaskJson with an invented version; backport patches that bumped version constants inconsistently between writeTaskJson and readTaskJson.","solutions":["Use the public entry points serializeV2()/serialize(3) rather than calling writeTaskJson directly.","Ensure any custom version bump updates writeTaskJson, readTaskJson, and the dispatch switch consistently.","Check merged backports/patches for mismatched version constants in IcebergSourceSplit.","Replace the split bytes and let the source re-serialize from a freshly planned scan if state is already corrupted."],"exampleFix":"// before\nsplit.writeTaskJson(out, json, 5); // unknown version\n// after\nsplit.writeTaskJson(out, json, 3); // long-UTF safe encoding","handlingStrategy":"validation","validationCode":"// only pass known versions\nif (version != 2 && version != 3) {\n  throw new IllegalArgumentException(\"writeTaskJson requires version 2 or 3, got \" + version);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use serializeV2()/serialize(3) public wrappers instead of internal writeTaskJson.","When bumping split format versions, update writer and reader switches together.","Add a round-trip unit test per supported version."],"tags":["flink","serialization","split","version-mismatch"],"backgroundTag":"invalid-argument-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}