apache/flink · error · IOException

Serialized data with version %d cannot be read by serializer

Error message

Serialized data with version %d cannot be read by serializer with version %d

What it means

Thrown by GSResumeRecoverableSerializer.deserialize when the serialized resume-recoverable data carries a version newer than this serializer's SERIALIZER_VERSION. Like the commit recoverable, the resume token (write channel id, position, pending blobs) is version-tagged so older code rejects data it cannot safely interpret when resuming a GCS recoverable stream.

Source

Thrown at flink-filesystems/flink-gs-fs-hadoop/src/main/java/org/apache/flink/fs/gs/writer/GSResumeRecoverableSerializer.java:91

                dataOutputStream.writeLong(recoverable.position);

                // closed
                dataOutputStream.writeBoolean(recoverable.closed);
            }

            outputStream.flush();
            return outputStream.toByteArray();
        }
    }

    @Override
    public GSResumeRecoverable deserialize(int version, byte[] serialized) throws IOException {
        Preconditions.checkArgument(version > 0);
        Preconditions.checkNotNull(serialized);

        // ensure this serializer can deserialize data with this version
        if (version > SERIALIZER_VERSION) {
            throw new IOException(
                    String.format(
                            "Serialized data with version %d cannot be read by serializer with version %d",
                            version, SERIALIZER_VERSION));
        }

        try (ByteArrayInputStream inputStream = new ByteArrayInputStream(serialized)) {

            try (DataInputStream dataInputStream = new DataInputStream(inputStream)) {

                // deserialize the commit recoverable part
                GSCommitRecoverable commitRecoverable =
                        GSCommitRecoverableSerializer.deserializeCommitRecoverable(dataInputStream);

                // position
                long position = dataInputStream.readLong();

                // closed
                boolean closed = dataInputStream.readBoolean();

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Run the restore with the same or newer plugin/Flink version that wrote the resume state
  2. Ensure one consistent flink-gs-fs-hadoop jar version on all nodes' lib/ directories
  3. If the pending file is disposable, discard the unresumable state and let the sink rewrite the file from the last checkpoint
Defensive patterns

Strategy: try-catch

Try / catch

try {
    recoverable = serializer.deserialize(version, bytes);
} catch (IOException e) {
    if (e.getMessage().contains("cannot be read by serializer")) {
        // state written by newer serializer: upgrade plugin, no point retrying
    }
    throw e;
}

Prevention

When it happens

Trigger: Resuming a GCS recoverable output stream from state serialized by a newer flink-gs-fs-hadoop plugin: GSResumeRecoverableSerializer.deserialize receives version > SERIALIZER_VERSION and fails.

Common situations: Rolling back Flink or the GCS plugin after pending-file state was checkpointed by a newer version; inconsistent plugin versions across job/task managers; state migration attempts across incompatible versions.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/d118c6b0f9f41a41. Report an issue: GitHub.