zed-industries/zed · error

Failed to create keymap

Error message

Failed to create keymap

What it means

When the compositor sends the keymap over a memfd, xkb::Keymap::new_from_fd is expected to succeed; the surrounding code already logs errors for the xkb context path, but a panic here means the fd-based keymap creation failed (bad fd, size mismatch, invalid keymap format) and keyboard input cannot be initialized.

Source

Thrown at crates/gpui_linux/src/linux/wayland/client.rs:1735

                state.wl_keyboard = Some(keyboard);
            }
            if capabilities.contains(wl_seat::Capability::Pointer) {
                let pointer = seat.get_pointer(qh, ());

                if let Some(cursor_shape_device) = state.cursor_shape_device.take() {
                    cursor_shape_device.destroy();
                }

                state.cursor_shape_device = state
                    .globals
                    .cursor_shape_manager
                    .as_ref()
                    .map(|cursor_shape_manager| cursor_shape_manager.get_pointer(&pointer, qh, ()));

                state.pinch_gesture = state.globals.gesture_manager.as_ref().map(
                    |gesture_manager: &zwp_pointer_gestures_v1::ZwpPointerGesturesV1| {
                        gesture_manager.get_pinch_gesture(&pointer, qh, ())
                    },
                );

                if let Some(wl_pointer) = &state.wl_pointer {
                    wl_pointer.release();
                }

                state.wl_pointer = Some(pointer);
            }
        }
    }
}

impl Dispatch<wl_keyboard::WlKeyboard, ()> for WaylandClientStatePtr {
    fn event(
        this: &mut Self,
        _: &wl_keyboard::WlKeyboard,
        event: wl_keyboard::Event,
        _: &(),

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Check the memfd contents are valid XKB_KEYMAP_FORMAT_TEXT_V1 keymap text
  2. Verify fd and size passed match the compositor-provided mapping
  3. Log the xkb error instead of panicking and fall back to a default keymap
  4. Update xkbcommon and verify compositor keymap support
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/gpui_linux/src/linux/wayland/client.rs:1729 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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