{"record":{"id":"ca34cf3c11100c51","repo":"egametang/ET","slug":"err-locationprimaryunavailable-ca34cf","errorCode":"ERR_LocationPrimaryUnavailable","errorMessage":"not found location scene in zone: {self.Zone()}","messagePattern":"not found location scene in zone: (.+?)","errorType":"exception","errorClass":"RpcException","httpStatus":null,"severity":"critical","filePath":"Packages/cn.etetet.actorlocation/Scripts/Hotfix/Server/LocationProxyComponentSystem.cs","lineNumber":69,"sourceCode":"                await ETTask.CompletedTask;\n            }\n        }\n\n        [EntitySystem]\n        private static void Awake(this LocationProxyComponent self)\n        {\n            self.primaryLocationPriorityId = 0;\n            self.locationRequestRetryTimes = 20;\n            self.locationRequestRetryIntervalMs = 100;\n        }\n\n        private static string GetPrimaryLocationSceneName(this LocationProxyComponent self)\n        {\n            ServiceDiscoveryProxy serviceDiscoveryProxy = self.Root().GetComponent<ServiceDiscoveryProxy>();\n            List<ServiceInfo> serviceInfos = serviceDiscoveryProxy.GetBySceneType(SceneType.Location);\n            if (serviceInfos.Count == 0)\n            {\n                throw new RpcException(ErrorCode.ERR_LocationPrimaryUnavailable, $\"not found location scene in zone: {self.Zone()}\");\n            }\n\n            ServiceInfo stablePrimaryServiceInfo = LocationPrimaryHelper.SelectStablePrimaryServiceInfo(serviceInfos);\n            string stablePrimarySceneName = stablePrimaryServiceInfo.SceneName;\n            ulong stablePrimaryPriorityId = LocationPrimaryHelper.GetPriorityId(stablePrimaryServiceInfo);\n            string primarySceneName = self.primaryLocationSceneName;\n            ulong primaryPriorityId = self.primaryLocationPriorityId;\n            if (primarySceneName == stablePrimarySceneName && primaryPriorityId == stablePrimaryPriorityId)\n            {\n                return stablePrimarySceneName;\n            }\n\n            self.primaryLocationSceneName = stablePrimarySceneName;\n            self.primaryLocationPriorityId = stablePrimaryPriorityId;\n            Log.Info(\n                $\"location proxy primary switch: {primarySceneName}({primaryPriorityId}) -> {stablePrimarySceneName}({stablePrimaryPriorityId}) scene: {self.Root().Name}\");\n            return stablePrimarySceneName;\n        }","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.actorlocation/Scripts/Hotfix/Server/LocationProxyComponentSystem.cs#L51-L87","documentation":"Thrown by LocationProxyComponent.GetPrimaryLocationSceneName when service discovery returns zero Location-type scenes for the current zone. The proxy cannot route any location request (Add, Remove, Lock, UnLock, Get) without a primary Location scene. This is a topology/deployment issue -- no Location scene is running or discoverable in the zone.","triggerScenarios":"CallPrimaryWithRetry calls GetPrimaryLocationSceneName, which queries serviceDiscoveryProxy.GetBySceneType(SceneType.Location) and the result count is 0. Every proxy operation (Add, Lock, Get, etc.) goes through CallPrimaryWithRetry, so all location operations fail with this error.","commonSituations":"No Location scene is configured in StartSceneConfig for the zone; the Location scene crashed and hasn't restarted; service discovery itself is down or not returning Location scenes; the SceneType.Location registration/subscription in FiberInit_Location failed; network partition between the proxy scene and service discovery.","solutions":["Ensure at least one StartSceneConfig with SceneType.Location exists for the zone.","Verify the Location scene process is running and has completed FiberInit_Location (check for 'location node registered' log).","Check service discovery connectivity -- the proxy must be able to reach ServiceDiscoveryProxy.GetBySceneType.","If this is transient (scene restarting), CallPrimaryWithRetry will retry up to locationRequestRetryTimes (default 20)."],"exampleFix":"// No code fix -- this is a deployment/topology issue.\n// Ensure StartSceneConfig includes a Location scene for the zone:\n// { SceneType = SceneType.Location, Zone = X, ... }","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// CallPrimaryWithRetry already retries ERR_LocationPrimaryUnavailable up to 20 times.\n// At the top-level caller, catch after retries are exhausted:\ntry\n{\n    await locationProxy.Add(type, key, actorId);\n}\ncatch (RpcException e) when (e.Error == ErrorCode.ERR_LocationPrimaryUnavailable)\n{\n    Log.Error($\"No Location scene available in zone after retries: {e.Message}\");\n    throw;\n}","preventionTips":["Ensure at least one Location scene is configured and running in each zone that uses location services.","Verify service discovery is operational and Location scenes are registered with SceneType.Location.","Monitor Location scene health -- if it crashes, all location operations will fail until it restarts."],"tags":["location","primary-election","service-discovery","deployment","topology"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}