{"record":{"id":"af01fc7ec6d8d34f","repo":"xai-org/grok-build","slug":"arboard-read-timed-out","errorCode":null,"errorMessage":"arboard read timed out","messagePattern":"arboard read timed out","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-shared/src/clipboard.rs","lineNumber":1337,"sourceCode":"    /// abandoned on expiry. The worker's `Clipboard` instance leaks with it;\n    /// harmless while the lease keeps the shared backend alive.\n    const ARBOARD_READ_WAIT: std::time::Duration = std::time::Duration::from_secs(2);\n\n    fn arboard_read_with_deadline<T: Send + 'static>(\n        op: impl FnOnce(&mut arboard::Clipboard) -> anyhow::Result<T> + Send + 'static,\n    ) -> anyhow::Result<T> {\n        use std::sync::mpsc::RecvTimeoutError;\n        if arboard_wayland_bypassed() {\n            anyhow::bail!(\"arboard leg disabled (GROK_CLIPBOARD_NO_DATA_CONTROL)\");\n        }\n        let result = spawn_with_deadline(\"clipboard-read\", ARBOARD_READ_WAIT, move || {\n            arboard::Clipboard::new()\n                .map_err(anyhow::Error::from)\n                .and_then(|mut clipboard| op(&mut clipboard))\n        });\n        match result {\n            Ok(inner) => inner,\n            Err(RecvTimeoutError::Timeout) => Err(anyhow::anyhow!(\"arboard read timed out\")),\n            Err(RecvTimeoutError::Disconnected) => Err(anyhow::anyhow!(\"arboard read worker died\")),\n        }\n    }\n\n    fn arboard_get_text() -> anyhow::Result<Option<String>> {\n        arboard_read_with_deadline(|clipboard| match clipboard.get_text() {\n            Ok(text) if text.is_empty() => Ok(None),\n            Ok(text) => Ok(Some(text)),\n            Err(arboard::Error::ContentNotAvailable) => Ok(None),\n            Err(err) => Err(err.into()),\n        })\n    }\n\n    #[cfg(target_os = \"linux\")]\n    fn arboard_get_primary_text() -> anyhow::Result<Option<String>> {\n        use arboard::{GetExtLinux, LinuxClipboardKind};\n        arboard_read_with_deadline(|clipboard| {\n            match clipboard","sourceCodeStart":1319,"sourceCodeEnd":1355,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-shared/src/clipboard.rs#L1319-L1355","documentation":"arboard_read_with_deadline (crates/codegen/xai-grok-shared/src/clipboard.rs:1337) runs arboard reads on a worker thread with a timeout because the Wayland data-control read can block forever on a hung selection owner. If the channel recv times out, it abandons the worker and returns this error. The read produced no result within the deadline.","triggerScenarios":"arboard_get_text, arboard_get_primary_text, arboard_get_image, or get_file_urls while the Wayland/X11 selection owner is hung or extremely slow to answer the paste request.","commonSituations":"A crashed-but-alive clipboard manager holding the selection on Wayland; remote apps owning the X11 selection over a slow forwarding link.","solutions":["Identify and restart the hung selection owner (clipboard manager / compositor).","Retry the read after the owner recovers; the abandoned worker exits on its own.","Fall back to CLI readers (wl-paste/xclip/pbpaste) when arboard times out repeatedly.","On X11 prefer the built-in 4s budget path; on Wayland ensure the data-control protocol is healthy."],"exampleFix":"// before\nlet text = arboard_get_text()?;\n// after\nlet text = match arboard_get_text() {\n    Ok(t) => t,\n    Err(e) if e.to_string().contains(\"timed out\") => cli_read_fallback()?,\n    Err(e) => return Err(e),\n};","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match arboard_get_text() {\n    Err(e) if e.to_string() == \"arboard read timed out\" => {\n        // selection owner hung; retry once or use CLI fallback\n        cli_read_fallback()\n    }\n    other => other,\n}","preventionTips":["Restart hung clipboard managers / compositors on affected Wayland boxes.","Treat timeouts as transient: retry with backoff before failing.","Keep wl-paste/xclip installed as an alternate read path."],"tags":["clipboard","arboard","wayland","timeout"],"backgroundTag":"clipboard-read-timeout","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}