Skip to content

Crash on headless servers: clipboard X11 connection failure #10

@Rxflex

Description

@Rxflex

When running jdbrowser on a headless Linux server over SSH (no GUI, no X11), the application crashes with the following panic:

The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: Unknown { .. } - "Unknown error while interacting with the clipboard: X11 server connection timed out because it was unreachable"
Location: src/ui/talbe_view.rs:141

📍 Cause

The code at src/ui/talbe_view.rs:141 unconditionally calls .unwrap() on Clipboard::new():

let clipboard = Clipboard::new().unwrap(); // Panics on headless systems

This fails when there's no X11 environment available (e.g., server-only systems or SSH sessions without X forwarding).

✅ Suggested Fix

Gracefully handle clipboard initialization failures:

let clipboard = match Clipboard::new() {
    Ok(cb) => Some(cb),
    Err(e) => {
        eprintln!("Clipboard init error: {e}");
        None
    }
};

Later code should check if let Some(cb) = clipboard before usage.

💡 Optional

Add support for disabling clipboard via environment variable, e.g.:

if std::env::var("DISABLE_CLIPBOARD").is_ok() {
    clipboard = None;
}

And run with:

DISABLE_CLIPBOARD=1 jdbrowser

🧪 Environment

  • OS: Ubuntu 22.04 Server
  • Access: SSH without GUI/X11
  • Version: latest

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions