iced-rs/iced · error

Send control action

Error message

Send control action

What it means

Panic from `control_sender.start_send(Control::Exit).expect("Send control action")` when the last window is destroyed. Fails only if the control channel receiver was dropped — i.e. the runtime's control loop already ended — an internal invariant violation of the control-flow channel.

Source

Thrown at winit/src/lib.rs:1001

                                    for (_id, window) in window_manager.iter_mut() {
                                        window.raw.request_redraw();
                                    }
                                }
                            },
                        }
                    }
                    event::Event::WindowEvent {
                        event: window_event,
                        window_id,
                    } => {
                        if !is_daemon
                            && matches!(window_event, winit::event::WindowEvent::Destroyed)
                            && !is_window_opening
                            && window_manager.is_empty()
                        {
                            control_sender
                                .start_send(Control::Exit)
                                .expect("Send control action");

                            continue;
                        }

                        let Some((id, window)) = window_manager.get_mut_alias(window_id) else {
                            continue;
                        };

                        match window_event {
                            winit::event::WindowEvent::Resized(_)
                            | winit::event::WindowEvent::Occluded(false) => {
                                window.raw.request_redraw();
                            }
                            winit::event::WindowEvent::ThemeChanged(theme) => {
                                let mode = conversion::theme_mode(theme);

                                if mode != system_theme {
                                    system_theme = mode;

View on GitHub (pinned to d146509d89)

Solutions

  1. Update iced/winit to latest
  2. Ensure you run a single application instance and don't drop the runtime while windows are open
  3. Fork fix: replace expect with `let _ = control_sender.start_send(Control::Exit);`

Example fix

// before
control_sender.start_send(Control::Exit).expect("Send control action");
// after
let _ = control_sender.start_send(Control::Exit);
Defensive patterns

Strategy: fallback

Validate before calling

// check window_manager.is_empty() only in the normal loop; avoid dropping the runtime while windows are open

Try / catch

// fork fix: replace expect with `let _ = control_sender.start_send(Control::Exit);`

Prevention

When it happens

Trigger: The last winit window reports Destroyed while the control_sender's receiver no longer exists (control loop exited early, e.g. after a Crash or during shutdown race with is_window_opening).

Common situations: Closing the final window during application teardown; crash handling that terminated the control consumer; nested/multiple runtimes sharing channels.

Related errors


AI-assisted analysis of iced-rs/iced@d146509d89 (2026-09-11). Data as JSON: /api/errors/7e579bd3707ad6e9. Report an issue: GitHub.