{"record":{"id":"7414ef20ce901aa6","repo":"egametang/ET","slug":"err-notfoundactor","errorCode":"ERR_NotFoundActor","errorMessage":"{message}","messagePattern":"\\{message\\}","errorType":"error_code","errorClass":"RpcException","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.actorlocation/Scripts/Hotfix/Server/MessageLocationSenderComponentSystem.cs","lineNumber":134,"sourceCode":"                    throw new RpcException(ErrorCode.ERR_MessageTimeout, $\"{message}\");\n                }\n                \n                if (messageLocationSender.ActorId == default)\n                {\n                    root = rootRef;\n                    self = selfRef;\n                    ActorId actorId = await root.GetComponent<LocationProxyComponent>().Get((int)self.Id, messageLocationSender.Id);\n                    messageLocationSender = messageLocationSenderRef;\n                    if (messageLocationSender == null)\n                    {\n                        throw new RpcException(ErrorCode.ERR_ActorLocationSenderTimeout2, $\"{message}\");\n                    }\n\n                    if (actorId == default)\n                    {\n                        self = selfRef;\n                        self?.Remove(entityId);\n                        throw new RpcException(ErrorCode.ERR_NotFoundActor, $\"{message}\");\n                    }\n\n                    messageLocationSender.ActorId = actorId;\n                }\n                \n                messageLocationSender = messageLocationSenderRef;\n                messageLocationSender.LastSendOrRecvTime = messageLocationSender.GetSingleton<TimeInfo>().ServerNow();\n                root = rootRef;\n                root.GetComponent<MessageSender>().Send(messageLocationSender.ActorId, message);\n            }\n        }\n\n        // 发给不会改变位置的actorlocation用这个，这种actor消息不会阻塞发送队列，性能更高，发送过去找不到actor不会重试\n        // 发送过去找不到actor不会重试,用此方法，你得保证actor提前注册好了location\n        public static async ETTask<IResponse> Call(this MessageLocationSenderOneType self, long entityId, IRequest request)\n        {\n            MessageLocationSender messageLocationSender = self.GetOrCreate(entityId);\n            EntityRef<MessageLocationSender> messageLocationSenderRef = messageLocationSender;","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.actorlocation/Scripts/Hotfix/Server/MessageLocationSenderComponentSystem.cs#L116-L152","documentation":"In SendInner, the location lookup completed and returned default(ActorId) — the entity has no registered location. The sender is explicitly removed (self.Remove(entityId)) and ERR_NotFoundActor is thrown. Unlike the timeout errors, this is a definitive 'entity does not exist in location' result, not a transient disposal.","triggerScenarios":"MessageLocationSenderOneType.Send(entityId, message) where entityId was never registered via Add/AddLocation, or whose location was already removed via Remove.","commonSituations":"Sending to an entity before it has registered its location (ordering bug). Sending to an entity after it was destroyed and its location cleaned up. Wrong entityId passed by the caller. Race between entity destruction and a pending send.","solutions":["Ensure the target entity registered its location via AddLocation(type) before any sends are attempted.","Verify the entityId is correct and the target entity still exists.","Catch RpcException with ERR_NotFoundActor and handle gracefully (drop the message, log a warning, or notify the sender).","Use the non-location MessageSender for actors that don't migrate, or guarantee registration ordering."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before sending, verify the entity has a registered location:\nActorId actorId = await root.GetComponent<LocationProxyComponent>().Get(type, entityId);\nif (actorId == default)\n{\n    Log.Warning($\"entity {entityId} has no location, skipping send\");\n    return;\n}\n// Now send safely\nsenderOneType.Send(entityId, message);","typeGuard":null,"tryCatchPattern":"try\n{\n    await senderOneType.SendAsync(entityId, message);\n}\ncatch (RpcException e) when (e.Error == ErrorCode.ERR_NotFoundActor)\n{\n    Log.Warning($\"entity {entityId} not found in location, cannot send\");\n    // drop message or notify caller\n}","preventionTips":["Ensure entities register their location via AddLocation(type) before any sends.","Verify entityId correctness at the call site.","Don't send to entities that may have been destroyed — check lifecycle first.","For non-migrating actors, consider using MessageSender directly instead of MessageLocationSender."],"tags":["message-routing","not-found","location","entity-missing"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}