{"record":{"id":"0866ca2d8d3255f0","repo":"tonhowtf/omniget","slug":"no-clipboard-tool-found-tried-xclip-xsel-wl-copy","errorCode":null,"errorMessage":"No clipboard tool found (tried xclip, xsel, wl-copy)","messagePattern":"No clipboard tool found \\(tried xclip, xsel, wl-copy\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/clipboard.rs","lineNumber":147,"sourceCode":"            use std::io::Write;\n            let _ = stdin.write_all(uri_clone.as_bytes());\n        }\n        let output = child.wait_with_output()?;\n        if output.status.success() {\n            Ok(true)\n        } else {\n            Ok(false)\n        }\n    })\n    .await\n    .map_err(|e| anyhow::anyhow!(\"{}\", e))?;\n\n    if let Ok(true) = wl_result {\n        tracing::info!(\"[clipboard] copied file to clipboard (wl-copy): {}\", path);\n        return Ok(());\n    }\n\n    Err(anyhow::anyhow!(\n        \"No clipboard tool found (tried xclip, xsel, wl-copy)\"\n    ))\n}\n\n#[cfg(target_os = \"windows\")]\nasync fn copy_file_windows(path: &str) -> anyhow::Result<()> {\n    let ps_script = format!(\"Set-Clipboard -LiteralPath '{}'\", path.replace('\\'', \"''\"));\n\n    let output = tokio::task::spawn_blocking(move || {\n        crate::core::process::std_command(\"powershell\")\n            .args([\"-NoProfile\", \"-NonInteractive\", \"-Command\", &ps_script])\n            .output()\n    })\n    .await\n    .map_err(|e| anyhow::anyhow!(\"spawn_blocking failed: {}\", e))??;\n\n    if !output.status.success() {\n        let stderr = String::from_utf8_lossy(&output.stderr);","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/clipboard.rs#L129-L165","documentation":"copy_file_linux tries three clipboard tools in order: xclip, xsel, and wl-copy. If all three are missing, fail to spawn, or report failure, it returns this terminal error. It means the machine has no supported clipboard utility available for the file-copy operation.","triggerScenarios":"copy_file_to_clipboard called on Linux where xclip, xsel, and wl-copy are either not installed, not on PATH, or all exit non-zero / fail to accept the file URI.","commonSituations":"Headless servers/containers with no X11 or Wayland clipboard; minimal Docker images; SSH sessions without a display (no DISPLAY/WAYLAND_DISPLAY env vars); broken desktop environments.","solutions":["Install a clipboard tool: `sudo apt install xclip` (X11) or `sudo apt install wl-clipboard` (Wayland).","Ensure DISPLAY (X11) or WAYLAND_DISPLAY (Wayland) environment variables are set and a clipboard daemon is running.","On headless systems, avoid the file-to-clipboard feature entirely or use an alternative transfer mechanism.","Check each tool manually (xclip -selection clipboard, xsel, wl-copy) to see which one fails and why."],"exampleFix":"// before\nErr(anyhow::anyhow!(\"No clipboard tool found (tried xclip, xsel, wl-copy)\"))\n\n// after\n// Precondition check by the caller before invoking clipboard copy\nif std::process::Command::new(\"which\").arg(\"xclip\").output().map(|o| !o.status.success()).unwrap_or(true)\n    && env::var(\"DISPLAY\").is_err() && env::var(\"WAYLAND_DISPLAY\").is_err() {\n    eprintln!(\"Clipboard unavailable: install xclip or wl-clipboard and set DISPLAY/WAYLAND_DISPLAY\");\n}","handlingStrategy":"validation","validationCode":"fn clipboard_tool_available() -> Option<&'static str> {\n    for tool in [\"xclip\", \"xsel\", \"wl-copy\"] {\n        if std::process::Command::new(\"which\").arg(tool).output()\n            .map(|o| o.status.success()).unwrap_or(false) {\n            return Some(tool);\n        }\n    }\n    None\n}","typeGuard":null,"tryCatchPattern":"match clipboard_tool_available() {\n    None => {\n        eprintln!(\"No clipboard tool available; install xclip or wl-clipboard\");\n        // skip clipboard feature gracefully\n    }\n    Some(_) => copy_file_to_clipboard(path).await?,\n}","preventionTips":["Detect headless environments (no DISPLAY/WAYLAND_DISPLAY) up front and disable clipboard features","Ship install docs for xclip/wl-clipboard","Probe tool availability once at startup","Provide an alternative export path (save to file) when no clipboard exists"],"tags":["clipboard","linux","missing-binary","headless"],"backgroundTag":"missing-dependency","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}