{"record":{"id":"09760697ecf3f3e3","repo":"zed-industries/zed","slug":"failed-to-initialize-x11-event-source-err","errorCode":null,"errorMessage":"Failed to initialize X11 event source: {err:?}","messagePattern":"Failed to initialize X11 event source: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_linux/src/linux/x11/client.rs","lineNumber":501,"sourceCode":"        // Safety: Safe if xcb::Connection always returns a valid fd\n        let fd = unsafe { FdWrapper::new(Rc::clone(&xcb_connection)) };\n\n        handle\n            .insert_source(\n                Generic::new_with_error::<EventHandlerError>(\n                    fd,\n                    calloop::Interest::READ,\n                    calloop::Mode::Level,\n                ),\n                {\n                    let xcb_connection = xcb_connection.clone();\n                    move |_readiness, _, client| {\n                        client.process_x11_events(&xcb_connection)?;\n                        Ok(calloop::PostAction::Continue)\n                    }\n                },\n            )\n            .map_err(|err| anyhow!(\"Failed to initialize X11 event source: {err:?}\"))?;\n\n        handle\n            .insert_source(XDPEventSource::new(&common.background_executor), {\n                move |event, _, client| match event {\n                    XDPEvent::WindowAppearance(appearance) => {\n                        client.with_common(|common| common.appearance = appearance);\n                        for window in client.0.borrow_mut().windows.values_mut() {\n                            window.window.set_appearance(appearance);\n                        }\n                    }\n                    XDPEvent::ButtonLayout(layout_str) => {\n                        let layout = WindowButtonLayout::parse(&layout_str)\n                            .log_err()\n                            .unwrap_or_else(WindowButtonLayout::linux_default);\n                        client.with_common(|common| common.button_layout = layout);\n                        for window in client.0.borrow_mut().windows.values_mut() {\n                            window.window.set_button_layout();\n                        }","sourceCodeStart":483,"sourceCodeEnd":519,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_linux/src/linux/x11/client.rs#L483-L519","documentation":"Raised in X11Client::new: calloop could not insert the Generic fd source that polls the XCB connection fd for readable X11 events. {err:?} is calloop's InsertError; if this fails the loop never receives X11 protocol events.","triggerScenarios":"Thrown at crates/gpui_linux/src/linux/x11/client.rs:486 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the xcb Connection's fd is valid and not already registered with the loop","Check for calloop token/source limit exhaustion in long-running processes","Abort startup with the propagated error rather than running a blind event loop"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}