iced-rs/iced · error
Get user interface
Error message
Get user interface
What it means
Panic from `user_interfaces.get_mut(&id).expect("Get user interface")` at the start of RedrawRequested handling. The UI map must contain an entry for every open window; a missing entry is an internal invariant violation in the runtime's window/interface bookkeeping.
Source
Thrown at winit/src/lib.rs:783
.insert(id, ui.relayout(logical_size, &mut window.renderer));
layout_span.finish();
current_compositor.configure_surface(
&mut window.surface,
physical_size.width,
physical_size.height,
);
window.surface_version = window.state.surface_version();
}
let redraw_event =
core::Event::Window(window::Event::RedrawRequested(Instant::now()));
let cursor = window.state.cursor();
let mut interface =
user_interfaces.get_mut(&id).expect("Get user interface");
let interact_span = debug::interact(id);
let mut redraw_count = 0;
let state = loop {
let message_count = messages.len();
let (state, _) = interface.update(
&window.raw,
&window.waker,
slice::from_ref(&redraw_event),
cursor,
&mut window.renderer,
&mut messages,
);
if message_count == messages.len() && !state.has_layout_changed() {
break state;
}View on GitHub (pinned to d146509d89)
Solutions
- Update iced/winit to the latest release
- Avoid racing Close actions against pending redraws
- Replace expect with `if let Some(ui)` and skip the redraw if absent when forking
Example fix
// before
let mut interface = user_interfaces.get_mut(&id).expect("Get user interface");
// after
let Some(mut interface) = user_interfaces.get_mut(&id) else { continue; }; Defensive patterns
Strategy: type-guard
Type guard
let Some(ui) = user_interfaces.get_mut(&id) else { continue; }; Prevention
- Don't send actions targeting a window id after Action::Close
- Avoid racing window close with pending redraw requests
- Update iced/winit to the latest release
When it happens
Trigger: RedrawRequested fires for a window id whose user interface was removed earlier (closed window, failed relayout path at line 761, or interface removed by run_action without removing the window).
Common situations: Window closed via Action::Close while a redraw request was already queued; scale-factor/resize race that removed the UI but failed to reinsert it; forked runtime modifications.
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
- Remove user interface
- Caches must not be empty
- Downcast widget state
- Downcast on stateless state
- {error:?}
AI-assisted analysis of iced-rs/iced@d146509d89 (2026-09-11).
Data as JSON: /api/errors/4380d435022e289c.
Report an issue: GitHub.