tonhowtf/omniget · error
wl-copy not found
Error message
wl-copy not found
What it means
On Wayland, copy_file_linux tries to spawn the wl-copy binary with MIME type text/uri-list to place a file URI on the clipboard. If wl-copy is not installed or cannot be spawned, the code immediately returns Err("wl-copy not found"). This is an environment/dependency problem, not a code bug.
Solutions
- Install the wl-clipboard package (e.g. `sudo apt install wl-clipboard` or `sudo dnf install wl-clipboard`).
- Verify `which wl-copy` resolves and that a Wayland compositor session is running.
- Ensure the code's fallback to xclip/xsel runs (the tool-choice logic should skip wl-copy when unavailable rather than hard-fail).
- Bundle or document the wl-clipboard dependency in the app's installation instructions.
Example fix
// before
Err(_) => return Err(anyhow::anyhow!("wl-copy not found")),
// after
Err(e) => {
tracing::warn!("[clipboard] wl-copy unavailable ({}), trying xclip", e);
return copy_file_xclip(path).await;
} Defensive patterns
Strategy: fallback
Validate before calling
fn wl_copy_available() -> bool {
std::process::Command::new("which").arg("wl-copy")
.output().map(|o| o.status.success()).unwrap_or(false)
} Try / catch
if wl_copy_available() {
copy_file_wl(path).await?;
} else {
copy_file_xclip(path).await.or_else(|_| copy_file_xsel(path)).await?;
} Prevention
- Install wl-clipboard on all Wayland target machines
- Check PATH for wl-copy before choosing the Wayland branch
- Document the wl-clipboard requirement in install instructions
- Always keep an X11 fallback (xclip/xsel) enabled
When it happens
Trigger: Calling copy_file_to_clipboard on a Wayland/Linux system where the wl-clipboard package (providing wl-copy) is not installed, or the binary is not on PATH so std_command("wl-copy").spawn() returns Err.
Common situations: Minimal Linux distributions or containers without wl-clipboard; CI environments with no Wayland session; users on X11-only systems running the wl-copy branch.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- No clipboard tool found (tried xclip, xsel, wl-copy)
- xclip not found
- {}
- xsel not found
- sessao Wayland sem XWayland: o x11grab nao enxerga a tela…
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/269b674ae591768b.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/clipboard.rs:126
}
})
.await
.map_err(|e| anyhow::anyhow!("{}", e))?;
if let Ok(true) = xsel_result {
tracing::info!("[clipboard] copied file URI to clipboard (xsel): {}", path);
return Ok(());
}
let uri_clone = uri.clone();
let wl_result = tokio::task::spawn_blocking(move || {
let mut child = match crate::core::process::std_command("wl-copy")
.args(["--type", "text/uri-list"])
.stdin(std::process::Stdio::piped())
.spawn()
{
Ok(c) => c,
Err(_) => return Err(anyhow::anyhow!("wl-copy not found")),
};
if let Some(ref mut stdin) = child.stdin {
use std::io::Write;
let _ = stdin.write_all(uri_clone.as_bytes());
}
let output = child.wait_with_output()?;
if output.status.success() {
Ok(true)
} else {
Ok(false)
}
})
.await
.map_err(|e| anyhow::anyhow!("{}", e))?;
if let Ok(true) = wl_result {
tracing::info!("[clipboard] copied file to clipboard (wl-copy): {}", path);
return Ok(());View on GitHub (pinned to 8600b91f42)