{"record":{"id":"9227cf684e6be4bd","repo":"EllanJiang/GameFramework","slug":"event-0-not-allow-no-handler","errorCode":null,"errorMessage":"Event '{0}' not allow no handler.","messagePattern":"Event '(.+?)' not allow no handler\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Base/EventPool/EventPool.cs","lineNumber":281,"sourceCode":"                    current = m_CachedNodes[e];\n                }\n\n                m_CachedNodes.Remove(e);\n            }\n            else if (m_DefaultHandler != null)\n            {\n                m_DefaultHandler(sender, e);\n            }\n            else if ((m_EventPoolMode & EventPoolMode.AllowNoHandler) == 0)\n            {\n                noHandlerException = true;\n            }\n\n            ReferencePool.Release(e);\n\n            if (noHandlerException)\n            {\n                throw new GameFrameworkException(Utility.Text.Format(\"Event '{0}' not allow no handler.\", e.Id));\n            }\n        }\n    }\n}\n","sourceCodeStart":263,"sourceCodeEnd":286,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Base/EventPool/EventPool.cs#L263-L286","documentation":"EventPool.HandleEvent throws this when an event was fired but no handler is subscribed to it and the pool was created with the noHandlerException option enabled. The pool releases the event args to ReferencePool, then throws GameFrameworkException to notify that the event was dropped unhandled.","triggerScenarios":"Calling Fire or FireNow for an event id while EventPool was constructed with (poolMode, true) — i.e. throwOnNoHandler enabled — and no Subscribe was performed for that id. Called from Update (deferred queue) or FireNow (immediate).","commonSituations":"Initialization-order issues where the subscriber hasn't subscribed yet but the publisher fires; typo/mismatch in event id constants; removing subscribers during scene unload while producers still fire; enabling the strict no-handler check in the EventComponent constructor or inspector without auditing all fire sites.","solutions":["Subscribe a handler for the event id before any code fires it.","Fix event id mismatches between publisher and subscriber constants.","Delay or reorder firing until after subscription (or use the deferred Fire and ensure Update runs after subscribers registered).","Construct the pool/EventComponent with allowNoHandler = true if dropped events are acceptable.","Audit all Fire/FireNow sites against the Subscribe list when the strict check is on."],"exampleFix":"// before\nm_EventComponent = new EventPool<EventEventArgs>(GameFrameworkMode.Default, true);\nm_EventComponent.Fire(this, args);\n// after\nm_EventComponent = new EventPool<EventEventArgs>(GameFrameworkMode.Default, false);\n// or: ensure subscribers exist first\nm_EventComponent.Subscribe(MyEventArgs.EventId, OnMyEvent);\nm_EventComponent.Fire(this, args);","handlingStrategy":"try-catch","validationCode":"if (pool.HasHandler(eventId, handler)) { pool.Fire(sender, e); } else { Log.Warning(\"No handler for event {0}\", eventId); }","typeGuard":null,"tryCatchPattern":"try { pool.Fire(sender, e); } catch (GameFrameworkException ex) when (ex.Message.Contains(\"not allow no handler\")) { Log.Warning(\"Event {0} fired with no subscriber\", e.Id); }","preventionTips":["Subscribe all handlers during initialization before any Fire call","Use a single source of truth for event id constants","Only enable the strict no-handler exception after auditing all fire sites","Prefer allowNoHandler=true in production if dropped events are tolerable"],"tags":["event-pool","no-handler","fire","gameframework","csharp"],"backgroundTag":"event-no-handler-registered","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"}