{"record":{"id":"c4b24ebed75ad80b","repo":"egametang/ET","slug":"not-found-handler-message-c4b24e","errorCode":null,"errorMessage":"not found handler: {message}","messagePattern":"not found handler: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.login/Scripts/Hotfix/Server/Realm/NetComponentOnReadInvoker_Realm.cs","lineNumber":31,"sourceCode":"            MessageStatisticsComponent messageStatisticsComponent = session.GetComponent<MessageStatisticsComponent>();\n            if (!messageStatisticsComponent.Check(message.GetType(), 10))\n            {\n                session.Error = ErrorCode.ERR_MessageCountTooMany;\n                session.Dispose();\n                return;\n            }\n            \n            // 根据消息接口判断是不是Actor消息，不同的接口做不同的处理,比如需要转发给Chat Scene，可以做一个IChatMessage接口\n            switch (message)\n            {\n                case ISessionMessage:\n                {\n                    MessageSessionDispatcher.Instance.Handle(session, message);\n                    break;\n                }\n                default:\n                {\n                    throw new Exception($\"not found handler: {message}\");\n                }\n            }\n        }\n    }\n}","sourceCodeStart":13,"sourceCodeEnd":36,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.login/Scripts/Hotfix/Server/Realm/NetComponentOnReadInvoker_Realm.cs#L13-L36","documentation":"Thrown by the Realm server message dispatcher (NetComponentOnReadInvoker_Realm) when an incoming message does not implement ISessionMessage. The Realm scene only dispatches session-based messages; anything else hits the default throw. The switch has only two cases: ISessionMessage (dispatched) and default (thrown).","triggerScenarios":"A client connects to the Realm server and sends a message that does not implement ISessionMessage. This could be an Actor message, an IRequest, or an unregistered message type.","commonSituations":"Client sends a login/account message type that doesn't implement ISessionMessage to the Realm. Message protocol mismatch between client and server. A message type was refactored and lost its ISessionMessage interface. Wrong scene type connection — client connected to Realm but sends messages meant for Gate or Map.","solutions":["Ensure the message type implements ISessionMessage if it should be dispatched by the Realm.","Verify the client is connecting to the correct scene type for the messages it sends.","If non-session messages should be supported, add the appropriate case to the switch."],"exampleFix":"// before: only ISessionMessage is handled\nswitch (message)\n{\n    case ISessionMessage:\n        MessageSessionDispatcher.Instance.Handle(session, message);\n        break;\n    default:\n        throw new Exception($\"not found handler: {message}\");\n}\n// after: add IRequest handling if needed\ncase IRequest request:\n    MessageSessionDispatcher.Instance.Handle(session, message);\n    break;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { DispatchRealmMessage(session, message); } catch (Exception e) { Log.Error($\"Realm dispatch failed for {message?.GetType().Name}: {e}\"); }","preventionTips":["Ensure all messages the Realm scene should handle implement ISessionMessage.","Verify the client connects to the correct scene type for its message protocol.","Log unrecognized message types to catch protocol drift early."],"tags":["network","realm","message-dispatch","server"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}