{"record":{"id":"a0def6e2fc2c2416","repo":"microsoft/garnet","slug":"unsupported-object-serialization-format-marker-0x","errorCode":null,"errorMessage":"Unsupported object serialization format marker 0x{firstByte:X2}; the data may have been written by a newer Garnet version.","messagePattern":"Unsupported object serialization format marker 0x(.+?); the data may have been written by a newer Garnet version\\.","errorType":"exception","errorClass":"GarnetException","httpStatus":null,"severity":"critical","filePath":"libs/server/Objects/Types/GarnetObjectSerializer.cs","lineNumber":60,"sourceCode":"        /// <returns></returns>\n        public IGarnetObject Deserialize(byte[] data)\n        {\n            Debug.Assert(data != null);\n\n            using var ms = new MemoryStream(data);\n            using var binaryReader = new BinaryReader(ms, Encoding.UTF8);\n            return DeserializeInternal(binaryReader);\n        }\n\n        private IGarnetObject DeserializeInternal(BinaryReader binaryReader)\n        {\n            var firstByte = binaryReader.ReadByte();\n\n            // 0xFC..0xFF are reserved for a future object-serialization format version/escape byte\n            // (see GarnetObjectType). No current writer emits these, so encountering one means the\n            // data was written by a newer version whose object format this build cannot read.\n            if (firstByte >= GarnetObjectTypeExtensions.ReservedObjectFormatByteStart)\n                throw new GarnetException($\"Unsupported object serialization format marker 0x{firstByte:X2}; the data may have been written by a newer Garnet version.\");\n\n            var type = (GarnetObjectType)firstByte;\n            var obj = type switch\n            {\n                GarnetObjectType.Null => null,\n                GarnetObjectType.SortedSet => new SortedSetObject(binaryReader),\n                GarnetObjectType.List => new ListObject(binaryReader),\n                GarnetObjectType.Hash => new HashObject(binaryReader),\n                GarnetObjectType.Set => new SetObject(binaryReader),\n                _ => CustomDeserialize((byte)type, binaryReader),\n            };\n            return obj;\n        }\n\n        private IGarnetObject CustomDeserialize(byte type, BinaryReader binaryReader)\n        {\n            // Built-in type ids (0..LastObjectType) are handled by the caller. A type id below the\n            // fixed custom-object base therefore lies in the reserved built-in band and is not valid","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/server/Objects/Types/GarnetObjectSerializer.cs#L42-L78","documentation":"Thrown by GarnetObjectSerializer.Deserialize when the first byte of a serialized object is >= 0xFC (ReservedObjectFormatByteStart). Bytes 0xFC-0xFF are reserved for a future versioned/escape format that no current writer emits, so encountering one means the record was written by a newer Garnet whose object format this build cannot read. It is a deliberate, fail-fast data-compatibility guard.","triggerScenarios":"Reading a checkpoint, AOF, or object log (object-store recovery) where the persisted object's leading byte is in the reserved band - i.e., the data was produced by a newer Garnet.","commonSituations":"Downgrading Garnet to an older version against data/checkpoints written by a newer version; loading a snapshot from a different Garnet edition.","solutions":["Do not downgrade Garnet across a version that introduced a new object-format escape byte; upgrade the reading node instead.","If you must move data, export it via RESP (DUMP/RESTORE or replication) rather than reusing on-disk object files across incompatible versions.","Confirm the build reading the data is at least as new as the build that wrote it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before recovering from a checkpoint/object log, assert build compatibility\nif (dataFormatByte >= 0xFC)\n    throw new InvalidOperationException(\"Refusing data from a newer Garnet object format (reserved leading byte).\");","typeGuard":null,"tryCatchPattern":"catch (GarnetException ex) when (ex.Message.Contains(\"Unsupported object serialization format marker\")) {\n    logger.LogCritical(\"On-disk object format is newer than this build; upgrade Garnet before recovering.\");\n    throw;\n}","preventionTips":["Never point an older Garnet at data written by a newer one.","Version your on-disk format and reject mismatched versions at startup before any read."],"tags":["serialization","version-mismatch","persistence","object-store"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}