m1k1o/neko · error

is not the host

Error message

is not the host

What it means

clipboardSet returns this error when the session has clipboard access permission but is not currently the host of the remote control session. Only the host may modify the shared desktop's clipboard, preventing non-host viewers from injecting clipboard content while someone else controls the machine.

Source

Thrown at server/internal/websocket/handler/clipboard.go:16

package handler

import (
	"errors"

	"github.com/m1k1o/neko/server/pkg/types"
	"github.com/m1k1o/neko/server/pkg/types/message"
)

func (h *MessageHandlerCtx) clipboardSet(session types.Session, payload *message.ClipboardData) error {
	if !session.Profile().CanAccessClipboard {
		return errors.New("cannot access clipboard")
	}

	if !session.IsHost() {
		return errors.New("is not the host")
	}

	return h.desktop.ClipboardSetText(types.ClipboardText{
		Text: payload.Text,
		// TODO: Send HTML?
	})
}

View on GitHub (pinned to b0f01cedea)

Solutions

  1. Take host control first (send a control request and become host) before setting the clipboard.
  2. Gate client-side clipboard paste actions on the client's host status.
  3. Suppress automatic clipboard-sync in the client when not host.
  4. If the user should own control, have the current host release it.

Example fix

// before
neko.websocket.send(message.ClipboardData{ Text: text }) // sent regardless of host status
// after
if (neko.state.isHost) {
  neko.websocket.send(message.ClipboardData{ Text: text })
}
Defensive patterns

Strategy: validation

Validate before calling

// client-side, before sending clipboard set
if (!state.isHost) {
  console.warn('not the host: clipboard write skipped')
  return
}

Type guard

function isHost(session, hostId) {
  return session != null && hostId != null && session.id === hostId
}

Try / catch

try {
  socket.emit('clipboard/set', { text })
} catch (e) {
  if (e.message === 'is not the host') requestControlThenRetry()
}

Prevention

When it happens

Trigger: A client with CanAccessClipboard sends a clipboard-set message (via controlPaste or the clipboard handler) while session.IsHost() is false — i.e. another session currently owns host control, or nobody does.

Common situations: Two users with clipboard permission; the second tries to paste before taking control; a user loses host control (another user took over or control was released) but their client still sends clipboard updates automatically from a clipboard watcher.

Related errors


AI-assisted analysis of m1k1o/neko@b0f01cedea (2026-09-01). Data as JSON: /api/errors/e12f2d835c853152. Report an issue: GitHub.