{"record":{"id":"0e22003fbb7b24f7","repo":"zed-industries/zed","slug":"x11-connection-insufficient-memory","errorCode":null,"errorMessage":"X11 connection: Insufficient memory","messagePattern":"X11 connection: Insufficient memory","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/gpui_linux/src/linux/x11/window.rs","lineNumber":444,"sourceCode":"    .log_err();\n    xcb_flush(xcb);\n}\n\n/// Convert X11 connection errors to `anyhow::Error` and panic for unrecoverable errors.\npub(crate) fn handle_connection_error(err: ConnectionError) -> anyhow::Error {\n    match err {\n        ConnectionError::UnknownError => anyhow!(\"X11 connection: Unknown error\"),\n        ConnectionError::UnsupportedExtension => anyhow!(\"X11 connection: Unsupported extension\"),\n        ConnectionError::MaximumRequestLengthExceeded => {\n            anyhow!(\"X11 connection: Maximum request length exceeded\")\n        }\n        ConnectionError::FdPassingFailed => {\n            panic!(\"X11 connection: File descriptor passing failed\")\n        }\n        ConnectionError::ParseError(parse_error) => {\n            anyhow!(parse_error).context(\"Parse error in X11 response\")\n        }\n        ConnectionError::InsufficientMemory => panic!(\"X11 connection: Insufficient memory\"),\n        ConnectionError::IoError(err) => anyhow!(err).context(\"X11 connection: IOError\"),\n        _ => anyhow!(err),\n    }\n}\n\nimpl X11WindowState {\n    pub fn new(\n        handle: AnyWindowHandle,\n        client: X11ClientStatePtr,\n        executor: ForegroundExecutor,\n        gpu_context: gpui_wgpu::GpuContext,\n        compositor_gpu: Option<CompositorGpuHint>,\n        params: WindowParams,\n        xcb: &Rc<XCBConnection>,\n        client_side_decorations_supported: bool,\n        x_main_screen_index: usize,\n        x_window: xproto::Window,\n        atoms: &XcbAtoms,","sourceCodeStart":426,"sourceCodeEnd":462,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_linux/src/linux/x11/window.rs#L426-L462","documentation":"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.","triggerScenarios":"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.","commonSituations":"OOM conditions on the desktop; cgroup/container memory limits; long-running sessions with leaks in the X server or driver stack.","solutions":["Free system memory (close applications) and retry launching Zed","Restart the X session if the X server itself is exhausted or leaking","Raise container/cgroup memory limits if running inside one; update Zed and graphics drivers to rule out leaks"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"# shell: check available memory before launch (example threshold)\navail=$(awk '/MemAvailable/ {print int($2/1024)}' /proc/meminfo)\n[ \"$avail\" -ge 512 ] || { echo \"low memory: ${avail}MB free\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Close memory-heavy apps before launching on constrained machines","Raise container/cgroup memory limits when running Zed inside one","If it recurs in normal sessions, suspect an X server/driver leak and restart the session"],"tags":["zed","gpui","linux","x11","xcb","out-of-memory","panic"],"backgroundTag":"x11-out-of-memory","analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}