{"record":{"id":"9b90b4dacc0f615e","repo":"apache/iceberg","slug":"could-not-deserialize-the-writeresult-object-9b90b4","errorCode":null,"errorMessage":"Could not deserialize the WriteResult object","messagePattern":"Could not deserialize the WriteResult object","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/WriteResultSerializer.java","lineNumber":58,"sourceCode":"  public byte[] serialize(WriteResult writeResult) throws IOException {\n    ByteArrayOutputStream out = new ByteArrayOutputStream();\n    DataOutputViewStreamWrapper view = new DataOutputViewStreamWrapper(out);\n    byte[] result = InstantiationUtil.serializeObject(writeResult);\n    view.write(result);\n    return out.toByteArray();\n  }\n\n  @Override\n  public WriteResult deserialize(int version, byte[] serialized) throws IOException {\n    if (version == 1) {\n      DataInputDeserializer view = new DataInputDeserializer(serialized);\n      byte[] resultBuf = new byte[serialized.length];\n      view.read(resultBuf);\n      try {\n        return InstantiationUtil.deserializeObject(\n            resultBuf, IcebergCommittableSerializer.class.getClassLoader());\n      } catch (ClassNotFoundException cnc) {\n        throw new IOException(\"Could not deserialize the WriteResult object\", cnc);\n      }\n    }\n    throw new IOException(\"Unrecognized version or corrupt state: \" + version);\n  }\n}\n","sourceCodeStart":40,"sourceCodeEnd":64,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/WriteResultSerializer.java#L40-L64","documentation":"WriteResultSerializer.deserialize reads an embedded WriteResult payload and uses InstantiationUtil.deserializeObject; if the resulting class is not on the classpath it throws IOException with this message, chaining the ClassNotFoundException. It is a Java-deserialization failure of the WriteResult carried inside an IcebergCommittable.","triggerScenarios":"Deserializing a committable whose WriteResult buffer references classes (e.g. an older WriteResult or contained data-file class) missing from the runtime classpath, typically across Iceberg version upgrades or fat-jar shading conflicts.","commonSituations":"Restoring a savepoint produced by a different Iceberg version; shaded/relocated org.apache.iceberg classes in the user jar conflicting with the connector; missing iceberg-core jar on the Flink cluster.","solutions":["Use the same Iceberg version for the job jar as the one that wrote the checkpoint/savepoint","Ensure iceberg-core is available on the Flink classpath and not relocated inconsistently (check shading config)","Restart without the incompatible savepoint state to rebuild committables from scratch"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  WriteResult r = WriteResultSerializer.deserialize(...);\n} catch (IOException e) {\n  if (e.getCause() instanceof ClassNotFoundException) {\n    throw new IllegalStateException(\"Iceberg classes missing from classpath; align job jar with checkpoint's Iceberg version\", e);\n  }\n  throw e;\n}","preventionTips":["Bundle iceberg-core in the user jar consistently (avoid partial shading)","Match Iceberg versions between the job that created checkpoints and the one restoring them","Verify the Flink lib/ directory doesn't contain conflicting iceberg jars"],"tags":["flink","serialization","classpath","version-compatibility"],"backgroundTag":"class-not-found","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"}