slint-ui/slint · error

internal error: accesskit adapter must exist when window…

Error message

internal error: accesskit adapter must exist when window exists

What it means

When the accesskit feature is enabled, every winit window adapter is expected to hold an accesskit adapter as long as the winit window exists. `accesskit_adapter()` returning `None` during event processing breaks this invariant and panics.

Solutions

  1. Update to the latest slint version (teardown races are often fixed upstream)
  2. Avoid programmatically destroying windows while pumping the event loop from nonstandard paths
  3. If reproducible, file a bug with a minimal reproducer - this is an internal invariant violation
Defensive patterns

Strategy: try-catch

Try / catch

std::panic::catch_unwind(|| window.handle().dispatch_event(event))
    .map_err(|_| anyhow!("accesskit event delivered during window teardown"))?;

Prevention

When it happens

Trigger: Processing a winit event for a window whose adapter's accesskit adapter was never created or already torn down - e.g. events arriving for a window being destroyed, or an internal ordering bug between window creation/destruction and event dispatch.

Common situations: Window closed/destroyed while events are still queued in the event loop; accessibility tooling (screen readers) triggering event delivery during teardown; race between adapter removal and pending events.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16). Data as JSON: /api/errors/fccd5f956a79ba89. Report an issue: GitHub.

Appendix: source

Thrown at internal/backends/winit/winitwindowadapter.rs:1284

    pub(crate) fn dispatch_winit_window_event(
        &self,
        event_loop: &ActiveEventLoop,
        winit_window: &winit::window::Window,
        event: WinitWindowEvent,
    ) -> Result<(), PlatformError> {
        if let Some(mut window_event_filter) = self.window_event_filter.take() {
            let event_result = window_event_filter(self.window(), &event);
            self.window_event_filter.set(Some(window_event_filter));

            match event_result {
                EventResult::PreventDefault => return Ok(()),
                EventResult::Propagate => (),
            }
        }

        #[cfg(enable_accesskit)]
        self.accesskit_adapter()
            .expect("internal error: accesskit adapter must exist when window exists")
            .borrow_mut()
            .process_event(winit_window, &event);

        let runtime_window = WindowInner::from_pub(self.window());
        self.maybe_set_custom_cursor(event_loop, winit_window);
        if !matches!(
            event,
            WinitWindowEvent::CursorMoved { .. } | WinitWindowEvent::AxisMotion { .. }
        ) {
            self.shared_backend_data.flush_pending_mouse_move();
        }

        match event {
            WinitWindowEvent::RedrawRequested => self.draw()?,
            WinitWindowEvent::Resized(size) => {
                let resized = self.resize_event(size);

                // Entering fullscreen, maximizing or minimizing the window will

View on GitHub (pinned to bb937076de)