zed-industries/zed · critical

X11 connection: Insufficient memory

Error message

X11 connection: Insufficient memory

What it means

The same XCB error mapper treats InsufficientMemory as unrecoverable: libxcb failed to allocate memory for the connection/request, and rendering cannot proceed, so it panics. Unlike the anyhow-mapped errors, this one reflects resource exhaustion inside the X connection layer itself.

Source

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

    .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,
        x_window: xproto::Window,
        atoms: &XcbAtoms,

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Free system memory (close applications) and retry launching Zed
  2. Restart the X session if the X server itself is exhausted or leaking
  3. Raise container/cgroup memory limits if running inside one; update Zed and graphics drivers to rule out leaks
Defensive patterns

Strategy: fallback

Validate before calling

# shell: check available memory before launch (example threshold)
avail=$(awk '/MemAvailable/ {print int($2/1024)}' /proc/meminfo)
[ "$avail" -ge 512 ] || { echo "low memory: ${avail}MB free"; exit 1; }

Prevention

When it happens

Trigger: System or X server memory exhaustion while Zed creates X resources (windows, pixmaps, buffers) — e.g. during heavy session restore or on memory-constrained machines/containers.

Common situations: OOM conditions on the desktop; cgroup/container memory limits; long-running sessions with leaks in the X server or driver stack.

Related errors


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