{"record":{"id":"ff65d5aa0487ebdc","repo":"xai-org/grok-build","slug":"arboard-unavailable","errorCode":null,"errorMessage":"arboard unavailable","messagePattern":"arboard unavailable","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-shared/src/clipboard.rs","lineNumber":1313,"sourceCode":"                }\n                match spawn_with_deadline(\n                    \"clipboard-init\",\n                    DISPLAY_CONN_WAIT,\n                    arboard::Clipboard::new,\n                ) {\n                    Ok(Ok(clipboard)) => Some(parking_lot::Mutex::new(clipboard)),\n                    Ok(Err(e)) => {\n                        tracing::debug!(\"arboard Clipboard::new failed: {e}\");\n                        None\n                    }\n                    Err(e) => {\n                        tracing::debug!(\"arboard Clipboard::new did not complete: {e}\");\n                        None\n                    }\n                }\n            })\n            .as_ref()\n            .ok_or_else(|| anyhow::anyhow!(\"arboard unavailable\"))\n    }\n\n    /// Deadline for in-process arboard reads. The Wayland data-control read has\n    /// no internal timeout and blocks forever on a hung selection owner (the\n    /// X11 path has a 4 s budget), so reads run on a worker thread that is\n    /// 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()","sourceCodeStart":1295,"sourceCodeEnd":1331,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-shared/src/clipboard.rs#L1295-L1331","documentation":"arboard_lease (crates/codegen/xai-grok-shared/src/clipboard.rs:1313) creates an arboard Clipboard on a worker thread; when Clipboard::new() fails or does not complete, the lease is None and this error is returned. It means no in-process clipboard backend could be initialized — usually no accessible display/selection server.","triggerScenarios":"arboard_set_text on a headless machine (no X11/Wayland display), with DISPLAY/WAYLAND_DISPLAY unset or pointing at a dead server, or when the clipboard init timed out and returned None.","commonSituations":"SSH sessions without X forwarding, CI containers, Wayland compositors without the data-control protocol, Windows services in session 0.","solutions":["Set DISPLAY (X11) or WAYLAND_DISPLAY correctly for the running process.","Run inside a graphical session or use x/wayland forwarding for SSH.","Install the missing Wayland/X11 clipboard protocol support or fall back to CLI tools (xclip/wl-copy/pbcopy).","If init is timing out, check for a hung compositor/selection owner."],"exampleFix":"// before\nclipboard.arboard_set_text(\"hi\")?; // fails headless\n// after\nif std::env::var_os(\"WAYLAND_DISPLAY\").or_else(|| std::env::var_os(\"DISPLAY\")).is_some() {\n    clipboard.arboard_set_text(\"hi\")?;\n} else {\n    eprintln!(\"no display; clipboard skipped\");\n}","handlingStrategy":"fallback","validationCode":"fn has_display() -> bool {\n    std::env::var_os(\"WAYLAND_DISPLAY\").is_some()\n        || std::env::var_os(\"DISPLAY\").is_some()\n}","typeGuard":null,"tryCatchPattern":"match arboard_set_text(text) {\n    Err(e) if e.to_string() == \"arboard unavailable\" => cli_set_text_fallback(text),\n    other => other,\n}","preventionTips":["Check DISPLAY/WAYLAND_DISPLAY before clipboard calls in headless environments.","Degrade gracefully: clipboard features should be optional in services/CI.","Log the underlying Clipboard::new error (it is already debug-logged) to diagnose compositor issues."],"tags":["clipboard","arboard","headless","linux"],"backgroundTag":"clipboard-unavailable","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}