m1k1o/neko · error
is not the host
Error message
is not the host
What it means
keyboardMap in server/internal/websocket/handler/keyboard.go rejects requests to change the remote keyboard layout when the sender is not the host. Keyboard layout is a host-level desktop setting, so only the session controlling the machine may alter it via h.desktop.SetKeyboardMap.
Source
Thrown at server/internal/websocket/handler/keyboard.go:12
package handler
import (
"errors"
"github.com/m1k1o/neko/server/pkg/types"
"github.com/m1k1o/neko/server/pkg/types/message"
)
func (h *MessageHandlerCtx) keyboardMap(session types.Session, payload *message.KeyboardMap) error {
if !session.IsHost() {
return errors.New("is not the host")
}
return h.desktop.SetKeyboardMap(payload.KeyboardMap)
}
func (h *MessageHandlerCtx) keyboardModifiers(session types.Session, payload *message.KeyboardModifiers) error {
if !session.IsHost() {
return errors.New("is not the host")
}
h.desktop.SetKeyboardModifiers(payload.KeyboardModifiers)
return nil
}
View on GitHub (pinned to b0f01cedea)
Solutions
- Take host control before sending keyboard map changes.
- Stop the client from auto-syncing keyboard layout when not host.
- Only send keyboard settings after receiving confirmation that the session is host.
- If layout control is needed, request host from the current host/admin.
Example fix
// before
socket.send({ event: 'keyboard/map', keyboardMap: layout }) // on focus
// after
if (state.isHost) socket.send({ event: 'keyboard/map', keyboardMap: layout }) Defensive patterns
Strategy: validation
Validate before calling
// client-side, before sending keyboard map
if (!state.isHost) {
console.warn('not the host: keyboard map change skipped')
return
} Type guard
function isCurrentHost(state) {
return state.hostId != null && state.hostId === state.sessionId
} Try / catch
try {
socket.emit('keyboard/map', keyboardMap)
} catch (e) {
if (e.message === 'is not the host') stopLayoutAutoSync()
} Prevention
- Only sync keyboard layout while hosting.
- Stop layout auto-sync listeners when host control is lost.
- Request host control first if layout changes are required.
- Apply layout changes once on host acquisition, not continuously.
When it happens
Trigger: A WebSocket client sends a keyboard map message while session.IsHost() is false.
Common situations: A viewer's client auto-syncing its local keyboard layout to the remote on connect or on window focus while another user hosts; a user who previously hosted and lost control but whose client still pushes layout settings.
Related errors
AI-assisted analysis of m1k1o/neko@b0f01cedea (2026-09-01).
Data as JSON: /api/errors/2f6e9513e670192f.
Report an issue: GitHub.