EllanJiang/GameFramework · error · GameFrameworkException

Serialize callback ' ' is not exist.

Error message

Serialize callback '{0}' is not exist.

What it means

The explicit-version Serialize(stream, data, version) looks up the callback registered for that exact version byte. It throws when the stream's header was accepted but no serialize callback exists for the requested version, using a formatted message that names the version.

Solutions

  1. Register a serialize callback for every version you pass/request, including legacy versions.
  2. Confirm the version constant passed to Serialize matches one used in RegisterSerializeCallback.
  3. Check m_SerializeCallbacks.ContainsKey(version) before serializing, or route through the versionless overload that uses the latest registered version.
  4. Keep registrations centralized (one registration table) so versions stay in sync across builds.

Example fix

// before
serializer.Serialize(stream, data, 2); // only version 1 registered
// after
if (!serializer.HasSerializeCallback(2)) // or check your registry
{
    serializer.RegisterSerializeCallback(2, SerializePlayerDataV2);
}
serializer.Serialize(stream, data, 2);
Defensive patterns

Strategy: validation

Validate before calling

var supported = new byte[] { 1, 2 }; // versions with registered callbacks
if (!supported.Contains(version)) { version = supported.Max(); }

Type guard

static bool VersionSupported(ISet<byte> registered, byte version) => registered.Contains(version);

Try / catch

try { serializer.Serialize(stream, data, version); } catch (GameFrameworkException ex) { log.Error("Unsupported serialize version: " + ex.Message); }

Prevention

When it happens

Trigger: Calling Serialize(stream, data, version) with a version byte that was never passed to RegisterSerializeCallback, or where callbacks were registered for different versions than the one requested.

Common situations: Version mismatch after upgrading serialization code (data saved/loaded with a version whose callback was removed); hard-coded version constants that no longer match registrations; loading old saves whose version numbers aren't registered in the new build.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15). Data as JSON: /api/errors/ce21fe05262d30b9. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/Base/GameFrameworkSerializer.cs:141

        /// <summary>
        /// 序列化数据到目标流中。
        /// </summary>
        /// <param name="stream">目标流。</param>
        /// <param name="data">要序列化的数据。</param>
        /// <param name="version">序列化回调函数的版本。</param>
        /// <returns>是否序列化数据成功。</returns>
        public bool Serialize(Stream stream, T data, byte version)
        {
            byte[] header = GetHeader();
            stream.WriteByte(header[0]);
            stream.WriteByte(header[1]);
            stream.WriteByte(header[2]);
            stream.WriteByte(version);
            SerializeCallback callback = null;
            if (!m_SerializeCallbacks.TryGetValue(version, out callback))
            {
                throw new GameFrameworkException(Utility.Text.Format("Serialize callback '{0}' is not exist.", version));
            }

            return callback(stream, data);
        }

        /// <summary>
        /// 从指定流反序列化数据。
        /// </summary>
        /// <param name="stream">指定流。</param>
        /// <returns>反序列化的数据。</returns>
        public T Deserialize(Stream stream)
        {
            byte[] header = GetHeader();
            byte header0 = (byte)stream.ReadByte();
            byte header1 = (byte)stream.ReadByte();
            byte header2 = (byte)stream.ReadByte();
            if (header0 != header[0] || header1 != header[1] || header2 != header[2])
            {

View on GitHub (pinned to d0c010b051)