m1k1o/neko · warning
unknown event type: %s
Error message
unknown event type: %s
What it means
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.
Source
Thrown at server/internal/http/legacy/wstobackend.go:384
"chat.can_send": false,
},
}, nil)
case oldEvent.ADMIN_UNMUTE:
request := &oldMessage.Admin{}
err := json.Unmarshal(msg, request)
if err != nil {
return err
}
return s.apiReq(http.MethodPost, "/api/members/"+request.ID, map[string]any{
"plugins": map[string]any{
"chat.can_send": true,
},
}, nil)
default:
return fmt.Errorf("unknown event type: %s", header.Event)
}
}
View on GitHub (pinned to b0f01cedea)
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
Example fix
// before
conn.send(JSON.stringify({event: "poll_create", ...}))
// after (supported legacy event)
conn.send(JSON.stringify({event: "chat", ...})) Defensive patterns
Strategy: validation
Validate before calling
var supportedEvents = map[string]bool{
oldEvent.CHAT_MESSAGE: true, oldEvent.CHAT_EMOTE: true,
oldEvent.SCREEN_RESOLUTION: true, oldEvent.ADMIN_LOCK: true,
// ... full set of shim-supported legacy events
}
if !supportedEvents[header.Event] {
log.Printf("event %q not supported by legacy shim, dropping", header.Event)
return
} Type guard
func isLegacyEventSupported(event string) bool {
_, ok := supportedEvents[event]
return ok
} Try / catch
if err := s.wsToBackend(msg); err != nil {
var unknownErr = "unknown event type"
if strings.Contains(err.Error(), unknownErr) {
log.Printf("unhandled legacy event %q ignored", header.Event)
return nil
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of m1k1o/neko@b0f01cedea (2026-09-01).
Data as JSON: /api/errors/8382de35e943bfdb.
Report an issue: GitHub.