zed-industries/zed · error

Parse error in X11 response

Error message

Parse error in X11 response

What it means

Mapping arm in handle_connection_error: bytes read from the X server failed to parse as a valid reply/error/event (ConnectionError::ParseError), usually from protocol desync — a malformed request sequence, concurrent unsynchronized use of the connection, or a server bug.

Source

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

        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(
        handle: AnyWindowHandle,
        client: X11ClientStatePtr,
        executor: ForegroundExecutor,
        gpu_context: gpui_wgpu::GpuContext,
        compositor_gpu: Option<CompositorGpuHint>,
        params: WindowParams,
        xcb: &Rc<XCBConnection>,
        client_side_decorations_supported: bool,
        x_main_screen_index: usize,

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Audit for concurrent writes to the same XCB connection that interleave request/reply sequences
  2. Verify all custom protocol structs match the X11 wire format (padding, endianness)
  3. Treat the connection as poisoned after a parse error: drop and reconnect rather than reuse it
Defensive patterns

Strategy: try-catch

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


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