egametang/ET · error · RpcException

service discovery agent response error, request: {requestNam

Error message

service discovery agent response error, request: {requestName}, error: {error}, message: {message}

What it means

RpcException thrown at line 274 in ServiceDiscoveryProxySystem.ForwardToDiscoveryByFailover: the proxy forwarded a request to the agent (ProcessInnerSender.Call to AgentFiberInstanceId) and the agent returned a response with Error != ERR_Success. The error code/message are wrapped and thrown to the proxy's caller. This propagates an application-level error from the discovery agent (which itself may have received it from the master).

Source

Thrown at Packages/cn.etetet.servicediscovery/Scripts/Hotfix/Server/ServiceDiscoveryProxySystem.cs:274

            }

            IResponse rawResponse = await self.ProcessInnerSender.Call(self.AgentFiberInstanceId, request);
            if (rawResponse is not T response)
            {
                (rawResponse as MessageObject)?.Dispose();
                throw new Exception(
                    $"service discovery agent response type mismatch, request: {requestName}, actual: {rawResponse?.GetType().Name}");
            }

            if (response.Error != ErrorCode.ERR_Success)
            {
                int error = response.Error;
                string message = response.Message;
                if (response is MessageObject messageObject)
                {
                    messageObject.Dispose();
                }
                throw new RpcException(error,
                    $"service discovery agent response error, request: {requestName}, error: {error}, message: {message}");
            }

            return response;
        }

        public static async ETTask<ActorId> ResolveServiceActorIdByRouteKeyAsync(this ServiceDiscoveryProxy self, int sceneType,
            long routeKey = 0)
        {
            EntityRef<ServiceDiscoveryProxy> selfRef = self;
            string sceneTypeName = SceneTypeSingleton.Instance.GetSceneName(sceneType);
            if (string.IsNullOrWhiteSpace(sceneTypeName))
            {
                throw new ArgumentException($"resolve service invalid sceneType: {sceneType}");
            }

            int retryCount = 0;
            while (true)

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Inspect the RpcException error code to determine whether it is master-unavailable (re-resolve), persistence (DB), or invalid-argument (fix payload).
  2. Ensure the agent fiber and master are healthy and reachable.
  3. Retry idempotent proxy operations (subscribe) on master-unavailable/follower-rejected codes.

Example fix

// before
var resp = await proxy.ForwardToDiscoveryByFailover<T>(req, name);

// after
catch (RpcException e) when (ServiceDiscoveryErrorHelper.ShouldTriggerFailover(e.Error))
{
    // transient master-side issue; retry the proxy call after a short delay
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the agent fiber instance is set before forwarding from the proxy.
if (proxy == null || proxy.AgentFiberInstanceId == default)
{
    Log.Warning("proxy agent fiber not initialized; cannot forward");
    return;
}

Try / catch

catch (RpcException e)
{
    if (ServiceDiscoveryErrorHelper.ShouldTriggerFailover(e.Error))
    {
        // transient master-side issue; retry idempotent proxy operations after delay
    }
    else
    {
        Log.Error($"discovery proxy forward failed {e.Error}: {e.Message}");
    }
}

Prevention

When it happens

Trigger: A proxy scene calls ForwardToDiscoveryByFailover (subscribe/unsubscribe/discovery queries) and the agent returns a non-success error — typically because the agent's own ForwardToDiscoveryByFailoverCore returned an error (master rejected the request, master unavailable, persistence failure).

Common situations: Master unavailable or follower-rejected when the proxy issues a discovery request; DB failure during a subscribe/persist operation; invalid arguments in the proxy request; the agent fiber could not reach the master.

Related errors


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