tonhowtf/omniget · error

xsel not found

Error message

xsel not found

What it means

If xclip failed on Linux, copy_file_linux falls back to xsel. When xsel also cannot be spawned (not installed), this 'xsel not found' error is returned — meaning neither clipboard utility is available.

Solutions

  1. Install a clipboard tool: sudo apt install xclip (preferred) or sudo apt install xsel.
  2. On Wayland, install wl-clipboard and check whether the app supports it, or run under XWayland.
  3. Verify with 'which xclip xsel' and retry the copy.

Example fix

// before
$ which xclip xsel  # neither installed
// after
$ sudo apt install xclip
$ omniget copy-file report.pdf
Defensive patterns

Strategy: validation

Validate before calling

const which = (bin) => { try { return require('child_process').execSync(`which ${bin}`).toString().trim(); } catch { return null; } };
if (!which('xclip') && !which('xsel')) {
  throw new Error('No clipboard tool found; run: sudo apt install xclip');
}

Prevention

When it happens

Trigger: copy_file_to_clipboard on Linux where xclip already failed and the xsel fallback binary is also missing from PATH.

Common situations: Minimal or headless Linux systems with neither xclip nor xsel installed; Wayland sessions without XWayland where both X tools are absent.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/02a44257957e5f5f. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/clipboard.rs:97

        }
    })
    .await
    .map_err(|e| anyhow::anyhow!("{}", e))?;

    if let Ok(true) = xclip_result {
        tracing::info!("[clipboard] copied file to clipboard (xclip): {}", path);
        return Ok(());
    }

    let uri_clone = uri.clone();
    let xsel_result = tokio::task::spawn_blocking(move || {
        let mut child = match crate::core::process::std_command("xsel")
            .args(["--clipboard", "--input"])
            .stdin(std::process::Stdio::piped())
            .spawn()
        {
            Ok(c) => c,
            Err(_) => return Err(anyhow::anyhow!("xsel 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) = xsel_result {
        tracing::info!("[clipboard] copied file URI to clipboard (xsel): {}", path);
        return Ok(());

View on GitHub (pinned to 8600b91f42)