{"record":{"id":"0b623288a26835b9","repo":"ppy/osu","slug":"deserialization-of-arbitrary-type-is-not-supported","errorCode":null,"errorMessage":"Deserialization of arbitrary type is not supported.","messagePattern":"Deserialization of arbitrary type is not supported\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"osu.Game/IO/Legacy/SerializationReader.cs","lineNumber":178,"sourceCode":"                    return ReadSingle();\r\n\r\n                case ObjType.DoubleType:\r\n                    return ReadDouble();\r\n\r\n                case ObjType.DecimalType:\r\n                    return ReadDecimal();\r\n\r\n                case ObjType.DateTimeType:\r\n                    return ReadDateTime();\r\n\r\n                case ObjType.ByteArrayType:\r\n                    return ReadByteArray();\r\n\r\n                case ObjType.CharArrayType:\r\n                    return ReadCharArray();\r\n\r\n                case ObjType.OtherType:\r\n                    throw new IOException(\"Deserialization of arbitrary type is not supported.\");\r\n\r\n                default:\r\n                    return null;\r\n            }\r\n        }\r\n    }\r\n\r\n    public enum ObjType : byte\r\n    {\r\n        NullType,\r\n        BoolType,\r\n        ByteType,\r\n        UInt16Type,\r\n        UInt32Type,\r\n        UInt64Type,\r\n        SByteType,\r\n        Int16Type,\r\n        Int32Type,\r","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/ppy/osu/blob/d9c73e12adff2feaae4a3e158d36fe5883faf6ca/osu.Game/IO/Legacy/SerializationReader.cs#L160-L196","documentation":"Thrown by SerializationReader when the type discriminator byte equals ObjType.OtherType during generic object deserialisation. The reader only supports primitive types, byte/char arrays, DateTime, and ILegacySerializable; an 'OtherType' marker indicates an arbitrary serialised object that this reader deliberately refuses to instantiate.","triggerScenarios":"Calling the generic ReadObject/deserialise path on a stream whose type byte is OtherType — i.e. the data was written by a serialiser that embedded a complex type the osu! reader can't reconstruct. A security/integrity guard against unexpected types.","commonSituations":"Replay or legacy data produced by a different/newer serialiser, a truncated stream where the type byte is garbage, or an attempt to read a section with the wrong reader method.","solutions":["Confirm the stream section is meant to be read with the generic object reader; if it's a known ILegacySerializable, use ReadBList<T>/the typed path instead.","Verify the data source and format version match the reader's expectations; reject incompatible files.","Catch IOException around deserialisation and treat the payload as unsupported rather than crashing the import."],"exampleFix":"// before\nobject value = reader.ReadObject(); // throws on OtherType\n\n// after\ntry\n{\n    object value = reader.ReadObject();\n}\ncatch (IOException ex) when (ex.Message.Contains(\"not supported\"))\n{\n    Logger.Log(\"Unsupported serialised type encountered; payload skipped.\", LoggingTarget.Database);\n}","handlingStrategy":"try-catch","validationCode":"// Before generic read, confirm the expected type byte for this field.\nObjType t = (ObjType)reader.PeekByte();\nif (t == ObjType.OtherType) throw new InvalidDataException(\"Unsupported object type in stream.\");","typeGuard":null,"tryCatchPattern":"try { object value = reader.ReadObject(); }\ncatch (IOException ex) when (ex.Message.Contains(\"not supported\"))\n{ /* skip unsupported payload */ }","preventionTips":["Use the typed reader methods (ReadBList<T>, primitives) for known fields instead of generic ReadObject.","Reject data from unknown/incompatible serialiser versions up front.","Isolate deserialisation failures so one bad record doesn't abort a batch."],"tags":["serialization","replay","binary-format","security","io"],"backgroundTag":null,"analyzedSha":"d9c73e12adff2feaae4a3e158d36fe5883faf6ca","analyzedAt":"2026-08-13T14:12:54.015Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}