Skip to content

Agent panics on startup on a headless system (clipboard can't find GUI) #227

@tirsek

Description

@tirsek

I have a similar problem as issue #143, but I think it's dissimilar enough to warrant its own issue. I'm running on a headless system (no GUI), so when the agent starts up and attempts to create a clipboard context, cli_clipboard::ClipboardContext::new() from within Agent::new fails, and the subsequent unwrap panics.

thread 'main' panicked at [...]/rbw/src/bin/rbw-agent/agent.rs:77:67:
called `Result::unwrap()` on an `Err` value: XcbConnect(DisplayParsingError)
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: core::result::Result<T,E>::unwrap
             at ./usr/src/debug/rust/rustc-1.83.0-src/library/core/src/result.rs:1104:23
   4: rbw_agent::agent::Agent::new
             at [...]/rbw/src/bin/rbw-agent/agent.rs:77:28

(Irrelevant stack frames omitted)

It appears that commit 9ad4ac8 first introduced the problem. Prior to this, I just get a warning in the agent.err file:

[2024-12-31T18:19:54Z WARN  rbw_agent::agent] couldn't create clipboard context: XCB - couldn't establish conection: DisplayParsingError(DisplayNotSet)

For now I'll build a version without clipboard support (thank you for making it optional).

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