Hmbown/CodeWhale · error · anyhow::Error

terminal clipboard writer stopped

Error message

terminal clipboard writer stopped

What it means

Lifecycle error from enqueue: the terminal clipboard writer's worker thread has shut down and closed the request channel, so try_send fails and the clipboard text can no longer be delivered to the terminal.

Source

Thrown at crates/tui/src/tui/clipboard.rs:249

            })
            .context("spawn terminal clipboard writer")?;
        Ok(Self {
            request_tx,
            completion_rx,
        })
    }

    fn enqueue(&self, text: &str, in_tmux: bool) -> Result<()> {
        let request = TerminalClipboardWriteRequest {
            text: text.to_string(),
            in_tmux,
        };
        self.request_tx.try_send(request).map_err(|err| match err {
            std::sync::mpsc::TrySendError::Full(_) => {
                anyhow::anyhow!("another terminal clipboard write is still queued")
            }
            std::sync::mpsc::TrySendError::Disconnected(_) => {
                anyhow::anyhow!("terminal clipboard writer stopped")
            }
        })
    }

    fn poll_completion(&self) -> Option<TerminalClipboardWriteCompletion> {
        self.completion_rx.try_recv().ok()
    }
}

/// Clipboard reader/writer helper.
pub struct ClipboardHandler {
    terminal_context: TerminalClipboardContext,
    terminal_writer: Option<TerminalClipboardWriter>,
    #[cfg(any(
        target_os = "macos",
        target_os = "windows",
        all(target_os = "linux", not(target_env = "ohos"))
    ))]

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Do not retry the write; the writer thread is gone and the request cannot be delivered.
  2. Fall back to an OS clipboard API or OSC52 escape sequence to write the clipboard directly.
  3. Log the failure and continue — clipboard write is a best-effort convenience, not a critical operation.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/tui/src/tui/clipboard.rs:249 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/a1f27a737d00c8d0. Report an issue: GitHub.