{"record":{"id":"8382de35e943bfdb","repo":"m1k1o/neko","slug":"unknown-event-type-s","errorCode":null,"errorMessage":"unknown event type: %s","messagePattern":"unknown event type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/internal/http/legacy/wstobackend.go","lineNumber":384,"sourceCode":"\t\t\t\t\"chat.can_send\": false,\n\t\t\t},\n\t\t}, nil)\n\n\tcase oldEvent.ADMIN_UNMUTE:\n\t\trequest := &oldMessage.Admin{}\n\t\terr := json.Unmarshal(msg, request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn s.apiReq(http.MethodPost, \"/api/members/\"+request.ID, map[string]any{\n\t\t\t\"plugins\": map[string]any{\n\t\t\t\t\"chat.can_send\": true,\n\t\t\t},\n\t\t}, nil)\n\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown event type: %s\", header.Event)\n\t}\n}\n","sourceCodeStart":366,"sourceCodeEnd":387,"githubUrl":"https://github.com/m1k1o/neko/blob/b0f01cedea68893e85a3fd852c0521238c285695/server/internal/http/legacy/wstobackend.go#L366-L387","documentation":"wsToBackend translates legacy websocket events into new backend API calls via a large switch on header.Event. The default branch returns fmt.Errorf(\"unknown event type: %s\", header.Event) for any event string that has no case, meaning the shim has no translation for it and the message is dropped.","triggerScenarios":"A legacy client sends a websocket message whose `event` field does not match any legacy event constant handled by wsToBackend — an unknown/renamed event, a message from a newer old-protocol version, or an event only supported natively by the new backend.","commonSituations":"Upgraded clients emitting events the legacy shim predates; typos in custom automation scripts sending raw websocket frames; two different clients speaking slightly different revisions of the old protocol against the same server.","solutions":["Log header.Event to identify exactly which event string was rejected","Check whether the event is handled elsewhere in the new backend and route it there instead of through the legacy shim","Add a case for the event in wsToBackend that performs the equivalent backend API call or toBackend forwarding","Align the legacy client version with the protocol revision the shim supports"],"exampleFix":"// before\nconn.send(JSON.stringify({event: \"poll_create\", ...}))\n// after (supported legacy event)\nconn.send(JSON.stringify({event: \"chat\", ...}))","handlingStrategy":"validation","validationCode":"var supportedEvents = map[string]bool{\n\toldEvent.CHAT_MESSAGE: true, oldEvent.CHAT_EMOTE: true,\n\toldEvent.SCREEN_RESOLUTION: true, oldEvent.ADMIN_LOCK: true,\n\t// ... full set of shim-supported legacy events\n}\nif !supportedEvents[header.Event] {\n\tlog.Printf(\"event %q not supported by legacy shim, dropping\", header.Event)\n\treturn\n}","typeGuard":"func isLegacyEventSupported(event string) bool {\n\t_, ok := supportedEvents[event]\n\treturn ok\n}","tryCatchPattern":"if err := s.wsToBackend(msg); err != nil {\n\tvar unknownErr = \"unknown event type\"\n\tif strings.Contains(err.Error(), unknownErr) {\n\t\tlog.Printf(\"unhandled legacy event %q ignored\", header.Event)\n\t\treturn nil\n\t}\n\treturn err\n}","preventionTips":["Pin legacy clients to a protocol version matching the shim","Log-and-drop unknown events in the client after checking support","Maintain a registry of supported legacy events shared between client and server tests"],"tags":["websocket","legacy-protocol","protocol-mismatch"],"backgroundTag":"unknown-message-type","analyzedSha":"b0f01cedea68893e85a3fd852c0521238c285695","analyzedAt":"2026-09-01T10:35:56.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}