egametang/ET · error · Exception
service discovery response type mismatch, request: {requestN
Error message
service discovery response type mismatch, request: {requestName}, actual: {rawResponse?.GetType().Name} What it means
Thrown at line 628 in ForwardToDiscoveryByFailoverCore: the master returned a response whose runtime type is not the expected T (the strongly-typed response the caller requested). The raw response is disposed and the call aborts. This indicates a contract/serialization mismatch between what the caller expects and what the master (or the routing layer) actually returned.
Source
Thrown at Packages/cn.etetet.servicediscovery/Scripts/Hotfix/Server/ServiceDiscoveryAgentSystem.cs:628
}
continue;
}
ActorId targetActorId = self.ServiceDiscoveryActorId;
try
{
IResponse rawResponse = await self.MessageSender.Call(targetActorId, request);
self = selfRef;
if (self == null)
{
throw new Exception("service discovery agent disposed");
}
if (rawResponse is not T response)
{
(rawResponse as MessageObject)?.Dispose();
throw new Exception(
$"service discovery 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 response error, request: {requestName}, error: {error}, message: {message}");
}
return response;
}
catch (Exception e)View on GitHub (pinned to 5cab01f7a8)
Solutions
- Ensure all processes run the same version of the service-discovery message assembly (rebuild and redeploy together).
- Confirm the request type maps to the expected response type T at the call site.
- Regenerate protocol/proto definitions and verify the response class is identical across client and master.
Example fix
// before: T does not match the request's actual response type var resp = await agent.ForwardToDiscoveryByFailover<WrongResponse>(req, name); // after: use the response type paired with the request var resp = await agent.ForwardToDiscoveryByFailover<ServiceRegisterResponse>(req, name);
Defensive patterns
Strategy: type-guard
Validate before calling
// Ensure the response type matches the request's contract before calling.
Type expected = ServiceDiscoveryProtocol.GetResponseType(req.GetType());
if (!expected.IsAssignableFrom(typeof(T)))
{
throw new InvalidOperationException($"Response type {typeof(T)} does not match request {req.GetType()}");
} Type guard
public static bool IsExpectedResponse<TRequest, TResponse>()
where TResponse : class, IResponse
{
return typeof(TResponse) == ServiceDiscoveryProtocol.GetResponseType(typeof(TRequest));
} Try / catch
catch (Exception e) when (e.Message.Contains("response type mismatch"))
{
Log.Error($"discovery response contract mismatch - redeploy matching versions: {e.Message}");
// trigger coordinated redeploy
} Prevention
- Deploy all processes with the same message assembly version.
- Regenerate protocol definitions in lockstep across services.
- Add a startup version-check between agent and master.
When it happens
Trigger: ForwardToDiscoveryByFailover<T> is called with a T that does not match the response type the master produces for that request; an error/exception response object was returned instead of the success response; partial deployment where master and agent run different code versions with changed message definitions.
Common situations: Version skew between client and server message assemblies; a request routed to the wrong handler returning a different response type; proto/regeneration out of sync so the response class identity differs across processes.
Related errors
- service discovery incremental register response mismatch sce
- ERR_ServiceDiscoveryMasterUnavailable
- service discovery endpoint unavailable after resolve, reques
- service discovery response error, request: {requestName}, er
- service discovery request retry exhausted, request: {request
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/6ec23c8d6780689f.
Report an issue: GitHub.