{"record":{"id":"a1e5b362209fa120","repo":"apache/iceberg","slug":"unrecognized-version-or-corrupt-state-version-a1e5b3","errorCode":null,"errorMessage":"Unrecognized version or corrupt state: ${version}","messagePattern":"Unrecognized version or corrupt state: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/WriteResultSerializer.java","lineNumber":61,"sourceCode":"    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":43,"sourceCodeEnd":64,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/WriteResultSerializer.java#L43-L64","documentation":"WriteResultSerializer.deserialize only supports its current VERSION marker; if the leading version read from the serialized bytes does not match, it throws IOException 'Unrecognized version or corrupt state: <version>'. This protects against decoding committables written by an incompatible serializer version or from a corrupted stream, mirroring IcebergCommittableSerializer's guard.","triggerScenarios":"Restoring from a savepoint/checkpoint written by a different Iceberg version with a different WriteResultSerializer layout, or deserializing truncated/garbled bytes between Writer and Aggregator/Committer operators so the version marker reads as an unexpected value.","commonSituations":"Upgrading iceberg-flink-runtime while resuming from an old savepoint; network/serialization corruption within a checkpoint (rare); classpath mixing two serializer implementations with different VERSION constants.","solutions":["Resume with the iceberg-flink-runtime version that wrote the checkpoint/savepoint","If versions must change, drain the pipeline first (commit all in-flight checkpoints) and restart without old committable state, or use --allowNonRestoredState if safe","Verify single consistent Iceberg jar version on the classpath (no duplicates/shadowing)","If corruption is suspected, inspect the failing checkpoint and restart from an earlier valid one"],"exampleFix":"// before\nflink run -s savepoint-written-by-iceberg-1.4 --jarfile iceberg-flink-runtime-1.20.0.jar job.jar\n// after\nflink run -s savepoint-written-by-iceberg-1.4 --jarfile iceberg-flink-runtime-1.4.3.jar job.jar\n# or: fully drain + fresh restart before upgrading the runtime","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return serializer.deserialize(version, bytes);\n} catch (IOException e) {\n  if (e.getMessage().startsWith(\"Unrecognized version\")) {\n    // incompatible state or corruption: never retry blindly; restart from valid checkpoint\n    throw new StateIncompatibleException(\"WriteResult format mismatch: \" + e.getMessage(), e);\n  }\n  throw e;\n}","preventionTips":["Keep iceberg-flink-runtime version constant across savepoint boundaries","Drain in-flight committables before runtime upgrades","Fail fast on version mismatch instead of attempting recovery from corrupt state","Verify checkpoint integrity when this error appears without a version upgrade"],"tags":["flink","serialization","checkpoint","iceberg"],"backgroundTag":"invalid-argument-format","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"}