{"record":{"id":"33dc1fee586b90e7","repo":"EllanJiang/GameFramework","slug":"entity-group-0-not-exists-specified-entity-1-2","errorCode":null,"errorMessage":"Entity group '{0}' not exists specified entity '[{1}]{2}'.","messagePattern":"Entity group '(.+?)' not exists specified entity '\\[(.+?)\\](.+?)'\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Entity/EntityManager.EntityGroup.cs","lineNumber":354,"sourceCode":"            public void AddEntity(IEntity entity)\n            {\n                m_Entities.AddLast(entity);\n            }\n\n            /// <summary>\n            /// 从实体组移除实体。\n            /// </summary>\n            /// <param name=\"entity\">要移除的实体。</param>\n            public void RemoveEntity(IEntity entity)\n            {\n                if (m_CachedNode != null && m_CachedNode.Value == entity)\n                {\n                    m_CachedNode = m_CachedNode.Next;\n                }\n\n                if (!m_Entities.Remove(entity))\n                {\n                    throw new GameFrameworkException(Utility.Text.Format(\"Entity group '{0}' not exists specified entity '[{1}]{2}'.\", m_Name, entity.Id, entity.EntityAssetName));\n                }\n            }\n\n            public void RegisterEntityInstanceObject(EntityInstanceObject obj, bool spawned)\n            {\n                m_InstancePool.Register(obj, spawned);\n            }\n\n            public EntityInstanceObject SpawnEntityInstanceObject(string name)\n            {\n                return m_InstancePool.Spawn(name);\n            }\n\n            public void UnspawnEntity(IEntity entity)\n            {\n                m_InstancePool.Unspawn(entity.Handle);\n            }\n","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Entity/EntityManager.EntityGroup.cs#L336-L372","documentation":"RemoveEntity removes an entity from the group's internal entity list and throws if the LinkedList<IEntity>.Remove call returns false, i.e. the entity was not present in this group. It is raised by InternalHideEntity when asked to hide an entity that the group does not actually own. This signals an internal bookkeeping inconsistency or a lookup targeting the wrong group.","triggerScenarios":"Calling InternalHideEntity/EntityManager.HideEntity with an entity id that maps to a different group, hiding an entity twice, or entity tables out of sync after a failed show/show-null state.","commonSituations":"Hiding entities across scene reloads where the id lookup is stale; double-hide in cleanup code that assumes idempotency; custom entity helpers bypassing the standard Show/Hide flow.","solutions":["Check that the entity id belongs to the given group before hiding (use EntityManager.HasEntity).","Make hide/cleanup code idempotent: check entity exists before calling HideEntity.","If this happens during shutdown, verify ShowEntity failure callbacks did not leave partial state; re-register or correct the entity-to-group mapping.","Catch GameFrameworkException around HideEntity in defensive teardown code."],"exampleFix":"// before\nentityManager.HideEntity(entityId);\n// after\nif (entityManager.HasEntity(entityId))\n{\n    entityManager.HideEntity(entityId);\n}","handlingStrategy":"validation","validationCode":"if (!entityManager.HasEntity(entityId)) return;\nentityManager.HideEntity(entityId);","typeGuard":null,"tryCatchPattern":"try { entityManager.HideEntity(entityId); }\ncatch (GameFrameworkException ex) { Log.Warning(\"Skip hide: {0}\", ex.Message); }","preventionTips":["Check entity existence with HasEntity before hiding","Make hide/teardown code idempotent","Track which group an entity belongs to if you use group-level APIs","Avoid double-hide from retry logic"],"tags":["csharp","gameframework","entity","not-found"],"backgroundTag":"entity-not-found","analyzedSha":"d0c010b05167c58e92350449d04864a91ca13fd2","analyzedAt":"2026-09-15T13:37:15.352Z","contentChangedAt":"2026-09-15T13:37:15.352Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}