egametang/ET · error · ArgumentException
ServiceAgentRegisterRequest invalid: AgentActorId is empty.
Error message
ServiceAgentRegisterRequest invalid: AgentActorId is empty.
What it means
ArgumentException thrown at line 722 in TryRegisterAgentToDiscoveryAsync: ServiceDiscoveryHelpers.TryValidateRequiredActorId failed because request.AgentActorId (set from self.Root().GetActorId()) is empty/default. The agent cannot register with the master without a valid own ActorId/address, so registration is rejected upfront.
Source
Thrown at Packages/cn.etetet.servicediscovery/Scripts/Hotfix/Server/ServiceDiscoveryAgentSystem.cs:722
if (self == null)
{
return false;
}
if (self.ServiceDiscoveryActorId == default)
{
return false;
}
EntityRef<ServiceDiscoveryAgent> selfRef = self;
ActorId targetActorId = self.ServiceDiscoveryActorId;
ServiceAgentRegisterRequest request = ServiceAgentRegisterRequest.Create();
request.AgentActorId = self.Root().GetActorId();
Address ownedAddress = request.AgentActorId.Address;
if (!ServiceDiscoveryHelper.TryValidateRequiredActorId(request.AgentActorId, nameof(ServiceAgentRegisterRequest),
nameof(request.AgentActorId), out string errorMessage))
{
throw new ArgumentException(errorMessage);
}
self.AppendOwnedLocalServices(request);
try
{
TimerComponent timer = self.Root().TimerComponent;
ETTask<IResponse> registerTask = self.MessageSender.Call(targetActorId, request);
IResponse rawResponse = await registerTask;
self = selfRef;
if (self == null)
{
(rawResponse as MessageObject)?.Dispose();
return false;
}
if (rawResponse is not ServiceAgentRegisterResponse response)
{View on GitHub (pinned to 5cab01f7a8)
Solutions
- Defer TriggerBackgroundRegister until the scene has a valid ActorId (ensure Root().GetActorId() != default before registering).
- Verify scene creation provides a concrete ProcessId/Address so GetActorId() is populated.
- Move registration initiation to a later lifecycle hook where identity is guaranteed.
Example fix
// before
public static void Awake(this ServiceDiscoveryAgent self)
{
self.EnsureBackgroundRegisterStarted(); // may run before ActorId set
}
// after: guard registration on a valid ActorId
if (self.Root().GetActorId() != default)
{
self.EnsureBackgroundRegisterStarted();
} Defensive patterns
Strategy: validation
Validate before calling
// Ensure the scene has a valid ActorId before triggering registration.
if (self.Root().GetActorId() == default)
{
Log.Warning("scene ActorId not yet assigned; deferring discovery registration");
return; // retry later
} Try / catch
catch (ArgumentException e) when (e.Message.Contains("AgentActorId is empty"))
{
Log.Warning($"deferred registration, ActorId not ready: {e.Message}");
// schedule a retry once the scene identity is set
} Prevention
- Trigger registration only after the scene's ActorId/Address is initialized.
- Move registration to a later lifecycle hook than Awake if identity is set later.
- Verify scene creation binds a concrete ProcessId/Address.
When it happens
Trigger: TriggerBackgroundRegister/TryRegisterAgentToDiscoveryAsync runs before the agent's Root Scene has a valid ActorId assigned — GetActorId() returns default because the scene/fiber identity is not yet initialized. Also possible if the scene's Process/Address is unset.
Common situations: Registration triggered too early in scene Awake (before ActorId is assigned); a scene created without a proper Address/Process binding; startup ordering where background registration fires during partial initialization.
Related errors
- service discovery agent disposed
- service discovery response error, request: {requestName}, er
- ERR_ServiceDiscoveryMasterUnavailable
- service discovery endpoint unavailable after resolve, reques
- service discovery response type mismatch, request: {requestN
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/9d42254d1a881f8e.
Report an issue: GitHub.