Need help deciphering this error message

One of my server RPCs is giving me an unhelpful error. The name of the server RPC is SpawnTracerServerRPC. This error only occurs on the server and it also only occurs when I try and Instantiate a RaycastWeapon during runtime and then try firing. If I spawn the player prefab with a RaycastWeapon the RPC works fine

Unhandled RPC Exception:
System.InvalidCastException: Specified cast is not valid.
  at RaycastWeapon.SpawnTracerServerRpc__nhandler (Unity.Netcode.NetworkBehaviour target, Unity.Netcode.FastBufferReader reader, Unity.Netcode.__RpcParams rpcParams) [0x00089] in <5c3ccea7be3344c5b6b1f7bdb72225ca>:0
UnityEngine.Debug:LogError (object)
RaycastWeapon:SpawnTracerServerRpc__nhandler (Unity.Netcode.NetworkBehaviour,Unity.Netcode.FastBufferReader,Unity.Netcode.__RpcParams)
Unity.Netcode.RpcMessage:Handle (Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkContext&,Unity.Netcode.NetworkManager,ulong,bool) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Messaging/Messages/RpcMessage.cs:93)
Unity.Netcode.NetworkBehaviour:__sendServerRpc (Unity.Netcode.FastBufferWriter,uint,Unity.Netcode.ServerRpcParams,Unity.Netcode.RpcDelivery) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkBehaviour.cs:87)
RaycastWeapon:SpawnTracerServerRpc (UnityEngine.Vector3) (at Assets/Scripts/RaycastWeapon.cs:39)
RaycastWeapon:Update () (at Assets/Scripts/RaycastWeapon.cs:30)

From the error message I’m having a hard time seeing which Specific cast is failing, could someone help point me in a direction to look?

I think I kind of figured out the issue. I was basically trying to add a nested NetworkBehaviour component to the player’s NetworkObject at runtime and I suspect the RPC calls weren’t working because the NetworkBehaviour wasn’t being associated properly with the players NetworkObject.

I tried adding a NetworkObject to the gameObject which contained the NetworkBehaviour but then I ended up hitting this bug I believe NetworkObject parenting per docs is not possible for a spawned player. · Issue #1523 · Unity-Technologies/com.unity.netcode.gameobjects · GitHub