{"record":{"id":"a1f27a737d00c8d0","repo":"Hmbown/CodeWhale","slug":"terminal-clipboard-writer-stopped","errorCode":null,"errorMessage":"terminal clipboard writer stopped","messagePattern":"terminal clipboard writer stopped","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/clipboard.rs","lineNumber":249,"sourceCode":"            })\n            .context(\"spawn terminal clipboard writer\")?;\n        Ok(Self {\n            request_tx,\n            completion_rx,\n        })\n    }\n\n    fn enqueue(&self, text: &str, in_tmux: bool) -> Result<()> {\n        let request = TerminalClipboardWriteRequest {\n            text: text.to_string(),\n            in_tmux,\n        };\n        self.request_tx.try_send(request).map_err(|err| match err {\n            std::sync::mpsc::TrySendError::Full(_) => {\n                anyhow::anyhow!(\"another terminal clipboard write is still queued\")\n            }\n            std::sync::mpsc::TrySendError::Disconnected(_) => {\n                anyhow::anyhow!(\"terminal clipboard writer stopped\")\n            }\n        })\n    }\n\n    fn poll_completion(&self) -> Option<TerminalClipboardWriteCompletion> {\n        self.completion_rx.try_recv().ok()\n    }\n}\n\n/// Clipboard reader/writer helper.\npub struct ClipboardHandler {\n    terminal_context: TerminalClipboardContext,\n    terminal_writer: Option<TerminalClipboardWriter>,\n    #[cfg(any(\n        target_os = \"macos\",\n        target_os = \"windows\",\n        all(target_os = \"linux\", not(target_env = \"ohos\"))\n    ))]","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tui/clipboard.rs#L231-L267","documentation":"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.","triggerScenarios":"Thrown at crates/tui/src/tui/clipboard.rs:249 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not retry the write; the writer thread is gone and the request cannot be delivered.","Fall back to an OS clipboard API or OSC52 escape sequence to write the clipboard directly.","Log the failure and continue — clipboard write is a best-effort convenience, not a critical operation."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}