{"record":{"id":"5c255e459e28b7fa","repo":"apache/flink","slug":"unrecognized-version-or-corrupt-state-version-5c255e","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-connectors/flink-file-sink-common/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/OutputStreamBasedPartFileWriter.java","lineNumber":397,"sourceCode":"            dataOutputSerializer.writeInt(MAGIC_NUMBER);\n            serializeV2(outputStreamBasedInProgressRecoverable, dataOutputSerializer);\n            return dataOutputSerializer.getCopyOfBuffer();\n        }\n\n        @Override\n        public InProgressFileRecoverable deserialize(int version, byte[] serialized)\n                throws IOException {\n            switch (version) {\n                case 1:\n                    DataInputView dataInputView = new DataInputDeserializer(serialized);\n                    validateMagicNumber(dataInputView);\n                    return deserializeV1(dataInputView);\n                case 2:\n                    dataInputView = new DataInputDeserializer(serialized);\n                    validateMagicNumber(dataInputView);\n                    return deserializeV2(dataInputView);\n                default:\n                    throw new IOException(\"Unrecognized version or corrupt state: \" + version);\n            }\n        }\n\n        public SimpleVersionedSerializer<RecoverableWriter.ResumeRecoverable>\n                getResumeSerializer() {\n            return resumeSerializer;\n        }\n\n        private void serializeV2(\n                final OutputStreamBasedInProgressFileRecoverable\n                        outputStreamBasedInProgressRecoverable,\n                final DataOutputView dataOutputView)\n                throws IOException {\n            boolean pathAvailable = outputStreamBasedInProgressRecoverable.targetPath != null;\n            dataOutputView.writeBoolean(pathAvailable);\n            if (pathAvailable) {\n                dataOutputView.writeUTF(\n                        outputStreamBasedInProgressRecoverable.targetPath.toUri().toString());","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-connectors/flink-file-sink-common/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/OutputStreamBasedPartFileWriter.java#L379-L415","documentation":"Thrown by OutputStreamBasedInProgressFileRecoverableSerializer.deserialize when the serialized state version is not 1 or 2. The serializer knows how to read exactly these two versions; any other version indicates either a newer format produced by a different Flink version or genuinely corrupt state bytes.","triggerScenarios":"Restoring a checkpoint or savepoint where the in-progress file recoverable state was written with a serializer version that the current code does not recognize (not 1 or 2).","commonSituations":"Downgrading Flink to an older version that does not support version 2 of the serializer; or restoring a checkpoint from a different file sink implementation.","solutions":["Do not downgrade Flink below the version that wrote the checkpoint; take a fresh savepoint if you need to downgrade.","If the error is from corruption, re-run the pipeline from the last known-good checkpoint without restoring the damaged one.","Verify that the checkpoint was produced by the same File Sink implementation (StreamingFileSink vs FileSink) being used for restore."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    serializer.deserialize(version, bytes);\n} catch (IOException e) {\n    if (e.getMessage().startsWith(\"Unrecognized version or corrupt state\")) {\n        LOG.error(\"Checkpoint state version {} not supported by this serializer version\", version);\n        // cannot recover — restart from a compatible checkpoint\n    }\n    throw e;\n}","preventionTips":["Do not downgrade Flink below the version that wrote the checkpoint.","Verify serializer version compatibility before restoring savepoints across versions.","Keep the same File Sink implementation (StreamingFileSink vs FileSink) for write and restore."],"tags":["file-sink","serialization","state-compatibility","checkpoint"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}