egametang/ET · error · RpcException

Rpc error: {request}, response: {response}

Error message

Rpc error: {request}, response: {response}

What it means

Thrown as RpcException by ClientSenderComponent.Call when the RPC response has an error code that ErrorCode.IsRpcNeedThrowException considers throwable, but is NOT the timeout code. This is the general RPC failure path for server-side errors, rejections, or protocol violations that require the caller to handle via exception.

Source

Thrown at Packages/cn.etetet.login/Scripts/Hotfix/Client/Login/ClientSenderComponentSystem.cs:86

            self.Root().GetComponent<ProcessInnerSender>().Send(self.FiberInstanceId, a2NetClientMessage);
        }

        public static async ETTask<IResponse> Call(this ClientSenderComponent self, IRequest request, bool needException = true)
        {
            A2NetClient_Request a2NetClientRequest = A2NetClient_Request.Create();
            a2NetClientRequest.MessageObject = request;
            
            using A2NetClient_Response a2NetClientResponse = await self.Root().GetComponent<ProcessInnerSender>().Call(self.FiberInstanceId, a2NetClientRequest) as A2NetClient_Response;
            IResponse response = a2NetClientResponse.MessageObject;
            
            if (response.Error == ErrorCode.ERR_MessageTimeout)
            {
                throw new RpcException(response.Error, $"Rpc error: request, 注意Actor消息超时,请注意查看是否死锁或者没有reply: {request}, response: {response}");
            }

            if (needException && ErrorCode.IsRpcNeedThrowException(response.Error))
            {
                throw new RpcException(response.Error, $"Rpc error: {request}, response: {response}");
            }
            return response;
        }

    }
}

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Read the ErrorCode value from the RpcException to determine the specific server-side failure reason.
  2. If the error is expected (e.g. auth retry), call with needException=false and handle the error code in the response instead.
  3. Fix the server-side handler that is returning the error code.

Example fix

// before: needException defaults to true, throws on any RPC error
IResponse resp = await self.Call(request);
// after: suppress exception and handle error code
IResponse resp = await self.Call(request, needException: false);
if (resp.Error != ErrorCode.ERR_Success)
{
    Log.Error($"RPC failed with code {resp.Error}");
    // handle gracefully
}
Defensive patterns

Strategy: try-catch

Try / catch

try { IResponse resp = await self.Call(request); } catch (RpcException e) { Log.Error($"RPC error {e.Error} for {request.GetType().Name}: {e.Message}"); /* handle specific error codes */ }

Prevention

When it happens

Trigger: The server responds with a non-timeout error code (e.g. authentication failure, invalid request, server internal error) and needException is true (the default). The caller gets an RpcException with the error code embedded.

Common situations: Authentication or authorization failure on the server. Invalid request parameters rejected by the server. Server-side exception during request handling that returns an error code. Passing needException=false to suppress the throw and inspect the error code manually.

Related errors


AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13). Data as JSON: /api/errors/fd01943418a538b3. Report an issue: GitHub.