micro-editor/micro · warning

No clipboard received from terminal

Error message

No clipboard received from terminal

What it means

Returned by the terminal (OSC 52) clipboard backend when micro sends a clipboard read request to the terminal and receives no tcell EventPaste within a hard-coded 200ms window. It means the terminal did not answer the escape-sequence clipboard query — most terminals either do not implement OSC 52 reads or deliberately disable them for security.

Source

Thrown at internal/clipboard/terminal.go:26

	"github.com/micro-editor/tcell/v2"
)

type terminalClipboard struct{}

var terminal terminalClipboard

func (t terminalClipboard) read(reg string) (string, error) {
	screen.Screen.GetClipboard(reg)
	// wait at most 200ms for response
	for {
		select {
		case event := <-screen.Events:
			e, ok := event.(*tcell.EventPaste)
			if ok {
				return e.Text(), nil
			}
		case <-time.After(200 * time.Millisecond):
			return "", errors.New("No clipboard received from terminal")
		}
	}
}

func (t terminalClipboard) write(text, reg string) error {
	return screen.Screen.SetClipboard(text, reg)
}

View on GitHub (pinned to 1c8b82b32e)

Solutions

  1. Switch method: `set clipboard external` (needs xclip/xsel/wl-clipboard/pbcopy present) or `set clipboard internal` (micro-local register only).
  2. If you want OSC 52 to work: use a terminal that supports clipboard queries (e.g. recent kitty/alacritty/wezterm) and inside tmux enable `set -g set-clipboard on` plus `set -as terminal-overrides ',*:Ms=...OSC52...'`.
  3. Increase tolerance: note the 200ms is hard-coded; on slow SSH links even capable terminals can miss the window, so prefer external over slow links.
  4. Verify support first: run `micro`, set clipboard=terminal, and attempt a paste; if the error appears, your terminal does not answer queries.

Example fix

# before (~/.config/micro/settings.json):
{ "clipboard": "terminal" }
# paste -> 'No clipboard received from terminal' after 200ms

# after:
{ "clipboard": "external" }  # and install xclip / wl-clipboard
Defensive patterns

Strategy: fallback

Try / catch

text, err := clipboard.Read(clipboard.ClipboardReg)
if err != nil {
    if strings.Contains(err.Error(), "No clipboard received from terminal") {
        clipboard.SetMethod("external") // or "internal"
        text, err = clipboard.Read(clipboard.ClipboardReg)
    }
}

Prevention

When it happens

Trigger: Setting "clipboard": "terminal" and then invoking paste/copy, in a terminal without OSC 52 clipboard-query support (many VTE-based terminals, terminals with clipboard reads disabled), or inside tmux/screen without the clipboard passthrough option enabled. The loop in internal/clipboard/terminal.go:26 waits on screen.Events and gives up at time.After(200ms).

Common situations: SSH sessions where the user expects clipboard forwarding via OSC 52, tmux users missing `set -g set-clipboard on`, or users switching from external tools (xclip/pbcopy) to the terminal method on a host whose terminal emulator rejects read queries.

Related errors


AI-assisted analysis of micro-editor/micro@1c8b82b32e (2026-08-15). Data as JSON: /api/errors/d4a6ad28d1077576. Report an issue: GitHub.