apache/iceberg · error · IOException

Could not deserialize the WriteResult object

Error message

Could not deserialize the WriteResult object

What it means

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.

Source

Thrown at flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/WriteResultSerializer.java:58

  public byte[] serialize(WriteResult writeResult) throws IOException {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    DataOutputViewStreamWrapper view = new DataOutputViewStreamWrapper(out);
    byte[] result = InstantiationUtil.serializeObject(writeResult);
    view.write(result);
    return out.toByteArray();
  }

  @Override
  public WriteResult deserialize(int version, byte[] serialized) throws IOException {
    if (version == 1) {
      DataInputDeserializer view = new DataInputDeserializer(serialized);
      byte[] resultBuf = new byte[serialized.length];
      view.read(resultBuf);
      try {
        return InstantiationUtil.deserializeObject(
            resultBuf, IcebergCommittableSerializer.class.getClassLoader());
      } catch (ClassNotFoundException cnc) {
        throw new IOException("Could not deserialize the WriteResult object", cnc);
      }
    }
    throw new IOException("Unrecognized version or corrupt state: " + version);
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Use the same Iceberg version for the job jar as the one that wrote the checkpoint/savepoint
  2. Ensure iceberg-core is available on the Flink classpath and not relocated inconsistently (check shading config)
  3. Restart without the incompatible savepoint state to rebuild committables from scratch
Defensive patterns

Strategy: try-catch

Try / catch

try {
  WriteResult r = WriteResultSerializer.deserialize(...);
} catch (IOException e) {
  if (e.getCause() instanceof ClassNotFoundException) {
    throw new IllegalStateException("Iceberg classes missing from classpath; align job jar with checkpoint's Iceberg version", e);
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/9b90b4dacc0f615e. Report an issue: GitHub.