{"record":{"id":"6d2c9974a22b27f7","repo":"Hmbown/CodeWhale","slug":"running-panel-has-an-id","errorCode":null,"errorMessage":"running panel has an id","messagePattern":"running panel has an id","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/mouse_ui.rs","lineNumber":205,"sourceCode":"\n    if let Some(panel) = app.workflow_panel.as_mut() {\n        panel.keyboard_focus = true;\n    }\n\n    let on_header_row = mouse.row == area.y;\n    let in_cancel_zone =\n        on_header_row && mouse_hits_rect(mouse, app.viewport.last_workflow_cancel_area);\n    let running = app\n        .workflow_panel\n        .as_ref()\n        .is_some_and(|panel| panel.lifecycle.is_running());\n\n    if in_cancel_zone && running {\n        let run_id = app\n            .workflow_panel\n            .as_ref()\n            .map(|panel| panel.run_id.clone())\n            .expect(\"running panel has an id\");\n        app.input = format!(\"/workflow cancel {run_id}\");\n        app.cursor_position = app.input.chars().count();\n        app.status_message = Some(app.tr(MessageId::SidebarDestructiveArmed).into_owned());\n        if let Some(panel) = app.workflow_panel.as_mut() {\n            panel.keyboard_focus = false;\n        }\n        app.needs_redraw = true;\n        return true;\n    }\n\n    // Any other click on the panel toggles expand/collapse.\n    app.toggle_workflow_panel();\n    true\n}\n\n/// Handle mouse events within the composer area.\n/// Returns true if the event was consumed.\npub(crate) fn handle_composer_mouse(app: &mut App, mouse: MouseEvent) -> bool {","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tui/mouse_ui.rs#L187-L223","documentation":"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.","triggerScenarios":"Thrown at crates/tui/src/tui/mouse_ui.rs:205 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set run_id at the same time lifecycle transitions to running so the two cannot diverge","Store run_id non-optionally on the panel type if it is always present while running","Combine the running check and run_id extraction into one is_some_and-style lookup to remove the double map"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}