zed-industries/zed · error

X11 connection: Unknown error

Error message

X11 connection: Unknown error

What it means

Mapping arm in handle_connection_error: the X11 server or connection produced a ConnectionError the xrb library does not classify (UnknownError). It is converted to an anyhow::Error for the caller; the doc comment notes unrecoverable connection errors panic elsewhere. Typically the connection was killed mid-request.

Source

Thrown at crates/gpui_linux/src/linux/x11/window.rs:433

    }

    if !urgent && !hints.urgent {
        return;
    }

    hints.urgent = urgent;
    check_reply(
        || "X11 ChangeProperty for WM_HINTS urgency failed.",
        hints.set(xcb, x_window),
    )
    .log_err();
    xcb_flush(xcb);
}

/// Convert X11 connection errors to `anyhow::Error` and panic for unrecoverable errors.
pub(crate) fn handle_connection_error(err: ConnectionError) -> anyhow::Error {
    match err {
        ConnectionError::UnknownError => anyhow!("X11 connection: Unknown error"),
        ConnectionError::UnsupportedExtension => anyhow!("X11 connection: Unsupported extension"),
        ConnectionError::MaximumRequestLengthExceeded => {
            anyhow!("X11 connection: Maximum request length exceeded")
        }
        ConnectionError::FdPassingFailed => {
            panic!("X11 connection: File descriptor passing failed")
        }
        ConnectionError::ParseError(parse_error) => {
            anyhow!(parse_error).context("Parse error in X11 response")
        }
        ConnectionError::InsufficientMemory => panic!("X11 connection: Insufficient memory"),
        ConnectionError::IoError(err) => anyhow!(err).context("X11 connection: IOError"),
        _ => anyhow!(err),
    }
}

impl X11WindowState {
    pub fn new(

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Log the underlying X11 error detail and reconnect/reopen windows when the connection dies
  2. Check for X server crash, SSH tunnel drop, or fd exhaustion as common causes of unknown connection errors
  3. Route the returned error up so the app can show a disconnection message instead of continuing on a dead connection
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/gpui_linux/src/linux/x11/window.rs:428 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20). Data as JSON: /api/errors/2129a8ce68b7c57e. Report an issue: GitHub.