Hmbown/CodeWhale · error

running panel has an id

Error message

running panel has an id

What it means

In the workflow cancel-zone click handler, is_some_and(lifecycle.is_running) confirmed the panel exists and is running, and run_id is assigned for the panel's lifetime, so the map/expect chain is guaranteed Some. It fires only if a running panel can exist without a run_id — an invariant break between panel lifecycle and id assignment.

Source

Thrown at crates/tui/src/tui/mouse_ui.rs:205

    if let Some(panel) = app.workflow_panel.as_mut() {
        panel.keyboard_focus = true;
    }

    let on_header_row = mouse.row == area.y;
    let in_cancel_zone =
        on_header_row && mouse_hits_rect(mouse, app.viewport.last_workflow_cancel_area);
    let running = app
        .workflow_panel
        .as_ref()
        .is_some_and(|panel| panel.lifecycle.is_running());

    if in_cancel_zone && running {
        let run_id = app
            .workflow_panel
            .as_ref()
            .map(|panel| panel.run_id.clone())
            .expect("running panel has an id");
        app.input = format!("/workflow cancel {run_id}");
        app.cursor_position = app.input.chars().count();
        app.status_message = Some(app.tr(MessageId::SidebarDestructiveArmed).into_owned());
        if let Some(panel) = app.workflow_panel.as_mut() {
            panel.keyboard_focus = false;
        }
        app.needs_redraw = true;
        return true;
    }

    // Any other click on the panel toggles expand/collapse.
    app.toggle_workflow_panel();
    true
}

/// Handle mouse events within the composer area.
/// Returns true if the event was consumed.
pub(crate) fn handle_composer_mouse(app: &mut App, mouse: MouseEvent) -> bool {

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Set run_id at the same time lifecycle transitions to running so the two cannot diverge
  2. Store run_id non-optionally on the panel type if it is always present while running
  3. Combine the running check and run_id extraction into one is_some_and-style lookup to remove the double map
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/tui/src/tui/mouse_ui.rs:205 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/6d2c9974a22b27f7. Report an issue: GitHub.