{"record":{"id":"f1f7d7c410f1c940","repo":"zellij-org/zellij","slug":"failed-to-find-pane-pane-id","errorCode":null,"errorMessage":"Failed to find pane {pane_id:?}","messagePattern":"Failed to find pane (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"zellij-server/src/tab/mouse_handler.rs","lineNumber":796,"sourceCode":"                pane_id: _,\n                position,\n            } => Self::execute_focus_pane(tab, position, client_id),\n            MouseAction::FocusPaneAndClickThrough {\n                pane_id: _,\n                position,\n                event: click_event,\n            } => Self::execute_focus_pane_and_click_through(tab, position, click_event, client_id),\n            MouseAction::ShowFloatingPanesAndFocus { pane_id } => {\n                tab.show_floating_panes();\n                tab.floating_panes.focus_pane(pane_id, client_id);\n                Ok(MouseEffect::state_changed())\n            },\n            MouseAction::StartSelection { pane_id, position } => {\n                let osc133_command_selection = tab.osc133_command_selection;\n                let word_separators = tab.word_separators.clone();\n                let pane = tab\n                    .get_pane_with_id_mut(pane_id)\n                    .ok_or_else(|| anyhow!(\"Failed to find pane {pane_id:?}\"))?;\n                let relative_position = pane.relative_position(&position);\n\n                let mut leave_clipboard_message = false;\n                pane.set_selection_options(osc133_command_selection, &word_separators);\n                pane.start_selection(&relative_position, client_id);\n                if pane.get_selected_text(client_id).is_some() {\n                    leave_clipboard_message = true;\n                }\n                if pane.supports_mouse_selection() {\n                    tab.selecting_with_mouse_in_pane = Some(pane_id);\n                }\n                if leave_clipboard_message {\n                    Ok(MouseEffect::state_changed_and_leave_clipboard_message())\n                } else {\n                    Ok(MouseEffect::default())\n                }\n            },\n            MouseAction::UpdateSelection { position } => {","sourceCodeStart":778,"sourceCodeEnd":814,"githubUrl":"https://github.com/zellij-org/zellij/blob/bf8d23a4f774abf27a108da2a1a2689e7d8d0d23/zellij-server/src/tab/mouse_handler.rs#L778-L814","documentation":"Thrown in the MouseAction::StartSelection handler (zellij-server/src/tab/mouse_handler.rs) when tab.get_pane_with_id_mut(pane_id) returns None. Mouse actions are computed during mouse-event processing and executed afterwards, so this fires when the pane a selection was started in no longer exists by the time the action runs.","triggerScenarios":"Mouse drag/click selects in a pane that exits between event parsing and action execution: a command pane finishing, a pane closed by another client in the same session, or replayed/queued mouse events referencing an already-closed pane id.","commonSituations":"Dragging a selection right as the pane's shell command exits; multi-client sessions where one user closes a pane while another is selecting in it.","solutions":["If occasional and correlated with a pane exiting mid-drag, it is a benign race — the selection is simply dropped; retry in a live pane.","If it persists, check whether the pane id in the message belongs to a different tab (cross-tab mouse routing) and report the exact mouse sequence upstream.","Update zellij for mouse-action lifetime fixes."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// check the pane still exists before starting a selection\nif tab.get_pane_with_id_mut(pane_id).is_some() {\n    // proceed with MouseAction::StartSelection\n} else {\n    return Ok(MouseEffect::default()); // pane gone: drop the action\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Ok(effect) => effect,\n    Err(e) if e.to_string().contains(\"Failed to find pane\") => {\n        log::debug!(\"mouse selection dropped: pane {pane_id:?} gone\");\n        MouseEffect::default()\n    },\n    Err(e) => return Err(e),\n}","preventionTips":["Treat mouse actions as stale by default: validate pane existence at execution time, not just at event-parse time.","In multi-client sessions, expect panes to vanish mid-gesture and degrade gracefully (cancel the selection).","Log the pane_id with the drop so stale-id sources are traceable."],"tags":["zellij","rust","mouse","selection","pane-not-found"],"backgroundTag":"pane-not-found","analyzedSha":"bf8d23a4f774abf27a108da2a1a2689e7d8d0d23","analyzedAt":"2026-08-19T07:42:58.758Z","contentChangedAt":"2026-08-19T07:42:58.758Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}