"Received an invalid Relay Bind Received message: Wrong length"

Hello! I am still new to multiplayer and Netcode for Gameobject/ Unity Services and ran into something that is stumping me.

I am getting this relay error in the console once every 20 seconds or so in both Host and Client consoles after a client connects via a Lobby. I searched online but cannot find any info regarding it.

Here is the console error:

Received an invalid Relay Received message: Wrong length
0x00007ff7c7dc5e2a (Unity) DefaultBurstRuntimeLogCallback
0x00007ff7c74955fa (Unity) BurstCompilerService_CUSTOM_RuntimeLog
0x00007ffc62cc9c02 (ef999a010cd80055dcb4debcdd1044d) Unity.Networking.Transport.Relay.RelayNetworkProtocol.ProcessRelayData (at F:/Unity Game Projects/Multiplayer Scorching/10-10-24/Library/PackageCache/com.unity.burst@1.8.18/.Runtime/Library/PackageCache/com.unity.transport@1.5.0/Runtime/Relay/RelayNetworkProtocol.cs:427)
0x00007ffc62cca560 (ef999a010cd80055dcb4debcdd1044d) Unity.Networking.Transport.Relay.RelayNetworkProtocol.ProcessReceive(System.IntPtr stream, ref Unity.Networking.Transport.NetworkInterfaceEndPoint endpoint, int size, ref Unity.Networking.Transport.NetworkSendInterface sendInterface, ref Unity.Networking.Transport.NetworkSendQueueHandle queueHandle, System.IntPtr userData, ref Unity.Networking.Transport.ProcessPacketCommand command) -> void_4a8673ec5b25397f38b5c69063b85440 from Unity.Networking.Transport, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (at F:/Unity Game Projects/Multiplayer Scorching/10-10-24/Library/PackageCache/com.unity.burst@1.8.18/.Runtime/Library/PackageCache/com.unity.transport@1.5.0/Runtime/Relay/RelayNetworkProtocol.cs:400)
0x00007ffc62cc9ae0 (ef999a010cd80055dcb4debcdd1044d) d34ee21f050e397b38df84c4fa2b361d
0x00007ffc62caea5f (ef999a010cd80055dcb4debcdd1044d) Unity.Networking.Transport.NetworkDriver.AppendPacket (at F:/Unity Game Projects/Multiplayer Scorching/10-10-24/Library/PackageCache/com.unity.burst@1.8.18/.Runtime/Library/PackageCache/com.unity.transport@1.5.0/Runtime/NetworkDriver.cs:1543)
0x00007ffc62cd1d08 (ef999a010cd80055dcb4debcdd1044d) Unity.Networking.Transport.NetworkPacketReceiver.AppendPacket (at F:/Unity Game Projects/Multiplayer Scorching/10-10-24/Library/PackageCache/com.unity.burst@1.8.18/.Runtime/Library/PackageCache/com.unity.transport@1.5.0/Runtime/INetworkInterface.cs:60)
0x00007ffc62cd2511 (ef999a010cd80055dcb4debcdd1044d) Unity.Jobs.IJobExtensions.JobStruct`1<Unity.Networking.Transport.BaselibNetworkInterface.ReceiveJob>.Execute(ref Unity.Networking.Transport.BaselibNetworkInterface.ReceiveJob data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) -> void_1a17c9416545ae7079718413b8a5101d from UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (at F:/Unity Game Projects/Multiplayer Scorching/10-10-24/Library/PackageCache/com.unity.burst@1.8.18/.Runtime/unknown/unknown:0)
0x00007ffc62cd14dd (ef999a010cd80055dcb4debcdd1044d) bf504eda069940d0a0a13ea8363bce1d
0x00007ff7c80b7a22 (Unity) ExecuteJob
0x00007ff7c80b8e0f (Unity) ForwardJobToManaged
0x00007ff7c80b4c3a (Unity) ujob_execute_job
0x00007ff7c80b406d (Unity) lane_guts
0x00007ff7c80b6ca4 (Unity) worker_thread_routine
0x00007ff7c82e468b (Unity) Thread::RunThreadWrapper
0x00007ffcaaac7374 (KERNEL32) BaseThreadInitThunk
0x00007ffcac6bcc91 (ntdll) RtlUserThreadStart

Navigating to the code linked in the error I found this switch statement but I do not really know what to do with it:

   case RelayMessageType.Relay:
                    var relayMessage = *(RelayMessageRelay*)data;
                    relayMessage.DataLength = RelayNetworkProtocol.SwitchEndianness(relayMessage.DataLength);
                    if (size < RelayMessageRelay.Length || size != RelayMessageRelay.Length + relayMessage.DataLength)
                    {
                        UnityEngine.Debug.LogError($"Received an invalid Relay Received message: Wrong length");
                        command.Type = ProcessPacketCommandType.Drop;
                        return true;
                    }

It seems like the relaymessage.datalength is not matching and maybe the packet is being dropped?

I am using Unity version 2022.3.49f1, Relay 1.1.1, and Lobby 1.2.2.
Any help would be greatly appreciated!

Thank you!

1 Like

I am encountering the same problem. I noticed the error yesterday and it also started appearing in older builds, maybe it’s related to Relay backend?

Unity version 2022.3.40f1, Relay 1.1.1, and Lobby 1.2.2.

Same for me since yesterday or even the day before. Using NGO 1.11.0, Relay 1.1.1, Lobby 1.2.2 and Unity 2022.3.50f

Same error, Unity 6, Multiplayer Services SDK, NGO, Matchmaking + Relay.

System.ArgumentException: The size of the required type (38) does not fit in the payload (22).
This Exception was thrown from a job compiled with Burst, which has limited exception support.
0x00007fff3ce39cfe (Unity) burst_abort

That part disappeared when I turned off burst in the editor.
And this problem remained, and apparently it is in Relay =>

ArgumentException: The size of the required type (38) does not fit in the payload (22).
Unity.Networking.Transport.PacketProcessor.RemoveFromPayloadStart[T] () (at ./Library/PackageCache/com.unity.transport/Runtime/PacketProcessor.cs:184)
Unity.Networking.Transport.RelayLayer+ReceiveJob`1[T].ProcessReceivedMessages () (at ./Library/PackageCache/com.unity.transport/Runtime/Layers/RelayLayer.cs:272)
Unity.Networking.Transport.RelayLayer+ReceiveJob`1[T].Execute () (at ./Library/PackageCache/com.unity.transport/Runtime/Layers/RelayLayer.cs:187)
Unity.Jobs.IJobExtensions+JobStruct`1[T].Execute (T& data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at <adbae017f0374fce9921b97a33a4e8ca>:0)
Unity.Jobs.JobHandle:ScheduleBatchedJobsAndComplete(JobHandle&)
Unity.Jobs.JobHandle:Complete()
Unity.Netcode.Transports.UTP.UnityTransport:Update() (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs:956)

We have identified the issue and released a fix in the backend. No action needed from customers.
New game sessions should no longer see this problem.

Thank you for raising this problem!

4 Likes

Thank you for the quick response!

Thank you so much for the quick response & fix @BGagnon_Unity !