{"record":{"id":"e12f2d835c853152","repo":"m1k1o/neko","slug":"is-not-the-host","errorCode":null,"errorMessage":"is not the host","messagePattern":"is not the host","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/websocket/handler/clipboard.go","lineNumber":16,"sourceCode":"package handler\n\nimport (\n\t\"errors\"\n\n\t\"github.com/m1k1o/neko/server/pkg/types\"\n\t\"github.com/m1k1o/neko/server/pkg/types/message\"\n)\n\nfunc (h *MessageHandlerCtx) clipboardSet(session types.Session, payload *message.ClipboardData) error {\n\tif !session.Profile().CanAccessClipboard {\n\t\treturn errors.New(\"cannot access clipboard\")\n\t}\n\n\tif !session.IsHost() {\n\t\treturn errors.New(\"is not the host\")\n\t}\n\n\treturn h.desktop.ClipboardSetText(types.ClipboardText{\n\t\tText: payload.Text,\n\t\t// TODO: Send HTML?\n\t})\n}\n","sourceCodeStart":1,"sourceCodeEnd":24,"githubUrl":"https://github.com/m1k1o/neko/blob/b0f01cedea68893e85a3fd852c0521238c285695/server/internal/websocket/handler/clipboard.go#L1-L24","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Take host control first (send a control request and become host) before setting the clipboard.","Gate client-side clipboard paste actions on the client's host status.","Suppress automatic clipboard-sync in the client when not host.","If the user should own control, have the current host release it."],"exampleFix":"// before\nneko.websocket.send(message.ClipboardData{ Text: text }) // sent regardless of host status\n// after\nif (neko.state.isHost) {\n  neko.websocket.send(message.ClipboardData{ Text: text })\n}","handlingStrategy":"validation","validationCode":"// client-side, before sending clipboard set\nif (!state.isHost) {\n  console.warn('not the host: clipboard write skipped')\n  return\n}","typeGuard":"function isHost(session, hostId) {\n  return session != null && hostId != null && session.id === hostId\n}","tryCatchPattern":"try {\n  socket.emit('clipboard/set', { text })\n} catch (e) {\n  if (e.message === 'is not the host') requestControlThenRetry()\n}","preventionTips":["Track host state from server control events and gate clipboard writes on it.","Disable automatic clipboard watchers while not hosting.","Take host control before pasting into the remote desktop.","Show host status in the UI so users know why paste fails."],"tags":["websocket","host-control","clipboard"],"backgroundTag":"not-the-host","analyzedSha":"b0f01cedea68893e85a3fd852c0521238c285695","analyzedAt":"2026-09-01T10:35:56.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}