EllanJiang/GameFramework · error · GameFrameworkException
Serialized packet failure.
Error message
Serialized packet failure.
What it means
In ProcessSend (run from the channel Update loop), the registered INetworkChannelHelper's serialization of the queued packet failed; the helper signals failure via its error message and GameFramework throws GameFrameworkException (or fires NetworkChannelError with NetworkErrorCode.SerializeError). This means the packet could not be converted to bytes for the wire.
Solutions
- Implement/fix the Serialize branch in your INetworkChannelHelper (PacketHandler) for the failing packet's Type.
- Check the packet's fields against the serialization format; fix data that cannot be encoded (e.g. oversized strings, wrong types).
- Log the packet type at failure to find which class lacks serializer support.
- Register NetworkChannelError to catch NetworkErrorCode.SerializeError and drop/blacklist the bad packet instead of crashing.
Example fix
// before
// NetworkChannelHelper.PacketHandler has no case for MyNewPacket
// after
switch (packet.GetType().Name) {
case "MyNewPacket":
stream.Write(...);
return true;
} Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure every packet type has a serializer before sending
if (!channelHelper.CanSerialize(packet.GetType())) throw new InvalidOperationException($"No serializer for {packet.GetType().Name}"); Try / catch
networkManager.NetworkChannelError += (channel, code, socketError, msg) => { if (code == NetworkErrorCode.SerializeError) DropPacketAndLog(channel, msg); }; Prevention
- Register a serializer case for every new Packet subclass
- Add a unit test that serializes every known packet type
- Validate payloads against protocol limits (string lengths, field sizes) before sending
- Log packet.GetType() in the helper's failure branch
When it happens
Trigger: A PacketHandler/Serialize call returning false for the packet type; sending a packet type the helper's serializer does not know how to handle; serializer internal failure (e.g. unsupported field, buffer overflow in the packet header length).
Common situations: Adding a new packet class without registering a serializer in the custom NetworkChannelHelper; protocol changes where the client serializes a message the helper's format cannot encode; serializing payloads exceeding the configured packet-length limits.
Understand the failure class
Background: json.Marshal / "failed to marshal" errors in Go: why "unsupported type" happens and how to fix it — this error's family across 22 libraries.
Related errors
- You must connect first.
- Socket is not active.
- Packet is invalid.
- Packet header is invalid.
- Packet header is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/9d85eaf040204d0f.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Network/NetworkManager.NetworkChannelBase.cs:535
{
SocketException socketException = exception as SocketException;
NetworkChannelError(this, NetworkErrorCode.SerializeError, socketException != null ? socketException.SocketErrorCode : SocketError.Success, exception.ToString());
return false;
}
throw;
}
if (!serializeResult)
{
string errorMessage = "Serialized packet failure.";
if (NetworkChannelError != null)
{
NetworkChannelError(this, NetworkErrorCode.SerializeError, SocketError.Success, errorMessage);
return false;
}
throw new GameFrameworkException(errorMessage);
}
}
m_SendState.Stream.Position = 0L;
return true;
}
protected virtual void ProcessReceive()
{
}
protected virtual bool ProcessPacketHeader()
{
try
{
object customErrorData = null;
IPacketHeader packetHeader = m_NetworkChannelHelper.DeserializePacketHeader(m_ReceiveState.Stream, out customErrorData);
View on GitHub (pinned to d0c010b051)