egametang/ET · error · Exception

location primary actor id is empty: {primarySceneName}

Error message

location primary actor id is empty: {primarySceneName}

What it means

Thrown by CallPrimaryWithRetry when the primary Location scene's ServiceInfo exists (was discovered) but its ActorId is default (zero). An ActorId of zero means the scene is registered but not addressable -- no actor is actually running at that address. This is an inconsistency between service discovery state and actual runtime state.

Source

Thrown at Packages/cn.etetet.actorlocation/Scripts/Hotfix/Server/LocationProxyComponentSystem.cs:126

            while (true)
            {
                self = selfRef;
                if (self == null)
                {
                    throw new Exception("location proxy disposed");
                }

                string primarySceneName = string.Empty;
                ulong primaryPriorityId = 0;
                try
                {
                    primarySceneName = self.GetPrimaryLocationSceneName();
                    primaryPriorityId = self.primaryLocationPriorityId;
                    ServiceDiscoveryProxy serviceDiscoveryProxy = self.Root().GetComponent<ServiceDiscoveryProxy>();
                    ActorId primaryActorId = serviceDiscoveryProxy.GetServiceInfo(primarySceneName).ActorId;
                    if (primaryActorId == default)
                    {
                        throw new Exception($"location primary actor id is empty: {primarySceneName}");
                    }

                    MessageSender messageSender = self.Root().GetComponent<MessageSender>();
                    if (messageSender == null)
                    {
                        throw new Exception($"location proxy message sender is null: {self.Root().Name}");
                    }

                    IResponse response = await messageSender.Call(primaryActorId, request);
                    if (response.Error == ErrorCode.ERR_LocationFollowerRejected
                        || response.Error == ErrorCode.ERR_LocationPrimaryUnavailable)
                    {
                        ++retryCount;
                        self = selfRef;
                        if (self == null)
                        {
                            return response;
                        }

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Wait for the Location scene to fully restart and re-register with a valid ActorId -- CallPrimaryWithRetry will retry.
  2. Check service discovery logs for proper ActorId registration.
  3. If persistent, investigate why ServiceInfo.ActorId is zero -- look at ServiceInfoSystem initialization.

Example fix

// No direct code fix -- this is a service discovery state issue.
// Verify the Location scene's ServiceInfo has a valid ActorId:
// Log.Info($"location scene actorId: {serviceInfo.ActorId}");
// If zero, the scene needs to re-register with service discovery.
Defensive patterns

Strategy: retry

Try / catch

// CallPrimaryWithRetry catches this as a generic Exception and retries.
// At the top level:
try
{
    await locationProxy.Add(type, key, actorId);
}
catch (Exception e) when (e.Message.Contains("location primary actor id is empty"))
{
    Log.Error($"Primary scene registered but has no valid ActorId: {e.Message}");
}

Prevention

When it happens

Trigger: serviceDiscoveryProxy.GetServiceInfo(primarySceneName).ActorId returns default(ActorId). This means the ServiceInfo entity has SceneName and Metadata but its ActorId was never set or was reset to zero during teardown.

Common situations: The Location scene is shutting down and its ServiceInfo was partially cleaned (ActorId zeroed but not yet removed from discovery); a race between scene teardown and service discovery update; a bug in service discovery registration that doesn't set ActorId.

Related errors


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