{"record":{"id":"d3dc3c6da05235f0","repo":"gfx-rs/wgpu","slug":"pointer-to-x-server-is-not-set","errorCode":null,"errorMessage":"Pointer to X-Server is not set.","messagePattern":"Pointer to X-Server is not set\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu-hal/src/vulkan/instance.rs","lineNumber":1081,"sourceCode":"    unsafe fn create_surface(\n        &self,\n        display_handle: raw_window_handle::RawDisplayHandle,\n        window_handle: raw_window_handle::RawWindowHandle,\n    ) -> Result<super::Surface, crate::InstanceError> {\n        use raw_window_handle::{RawDisplayHandle as Rdh, RawWindowHandle as Rwh};\n\n        // TODO: Replace with ash-window, which also lazy-loads the extension based on handle type\n\n        match (window_handle, display_handle) {\n            (Rwh::Wayland(handle), Rdh::Wayland(display)) => {\n                self.create_surface_from_wayland(display.display.as_ptr(), handle.surface.as_ptr())\n            }\n            (Rwh::Xlib(handle), Rdh::Xlib(display)) => {\n                let display = display.display.expect(\"Display pointer is not set.\");\n                self.create_surface_from_xlib(display.as_ptr(), handle.window)\n            }\n            (Rwh::Xcb(handle), Rdh::Xcb(display)) => {\n                let connection = display.connection.expect(\"Pointer to X-Server is not set.\");\n                self.create_surface_from_xcb(connection.as_ptr(), handle.window.get())\n            }\n            #[cfg(drm)]\n            (Rwh::Drm(handle), Rdh::Drm(display)) => {\n                self.create_surface_from_drm_plane(display.fd, handle.plane)\n            }\n            (Rwh::AndroidNdk(handle), _) => {\n                self.create_surface_android(handle.a_native_window.as_ptr())\n            }\n            #[cfg(target_env = \"ohos\")]\n            (Rwh::OhosNdk(handle), _) => self.create_surface_ohos(handle.native_window.as_ptr()),\n            (Rwh::Win32(handle), _) => {\n                let hinstance = handle.hinstance.ok_or_else(|| {\n                    crate::InstanceError::new(String::from(\n                        \"Vulkan requires raw-window-handle's Win32::hinstance to be set\",\n                    ))\n                })?;\n                self.create_surface_from_hwnd(hinstance.get(), handle.hwnd.get())","sourceCodeStart":1063,"sourceCodeEnd":1099,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu-hal/src/vulkan/instance.rs#L1063-L1099","documentation":"Panic in the Vulkan instance's create_surface: the X11 raw display handle's connection pointer is NULL, so an Xlib/XCB surface cannot be created. The faulty input is the unset X-Server connection in the display handle.","triggerScenarios":"Thrown at wgpu-hal/src/vulkan/instance.rs:1081 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the X11 connection is established and passed as a non-null pointer in the display handle","Create the surface through a windowing library that fills the handle correctly"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}