{"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":784,"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":766,"sourceCodeEnd":802,"githubUrl":"https://github.com/zellij-org/zellij/blob/98a0837077492d53dd252ab30bc3e43e41e504f4/zellij-server/src/tab/mouse_handler.rs#L766-L802","documentation":"Returned by the mouse handler's StartSelection action when tab.get_pane_with_id_mut cannot find the pane id attached to the mouse action. The mouse click that should start a text selection cannot locate its target pane, so the selection gesture is aborted with an error.","triggerScenarios":"A mouse press that begins a selection arrives with a pane id that no longer exists in the tab - typically because the pane closed while a click/drag was in flight, or the action was computed from stale pane geometry after a layout change.","commonSituations":"Click-drag text selection racing a pane exit or resize; selecting text in a pane closed by a background process; mouse events processed after a layout swap (swap-layout) invalidated pane ids; remote/latency-induced reordering of close vs. click events.","solutions":["Retry the selection gesture - if the pane list changed, the next click resolves fresh state","Avoid clicking into a pane that is in the middle of closing/resizing; let the layout settle","If reproducible on stable layouts, capture `zellij --debug` logs and the exact click coordinates; report as a pane-id staleness bug","Plugin authors: recompute pane positions after receiving layout-change events instead of reusing cached ids"],"exampleFix":"// before\nlet pane = tab\n    .get_pane_with_id_mut(pane_id)\n    .ok_or_else(|| anyhow!(\"Failed to find pane {pane_id:?}\"))?;\n\n// after: no-op gracefully when the pane vanished mid-gesture\nlet Some(pane) = tab.get_pane_with_id_mut(pane_id) else {\n    log::debug!(\"StartSelection: pane {pane_id:?} no longer exists, ignoring\");\n    return Ok(MouseEffect::default());\n};","handlingStrategy":"try-catch","validationCode":"// before acting on a mouse action carrying a pane id:\nif tab.get_pane_with_id_mut(pane_id).is_none() {\n    return Ok(MouseEffect::default());\n}","typeGuard":"fn selection_target_exists(tab: &Tab, pane_id: PaneId) -> bool {\n    tab.get_pane_with_id(pane_id).is_some()\n}","tryCatchPattern":"// in MouseHandler dispatch: degrade selection failures to no-ops\nmatch MouseHandler::handle_mouse_action(action, tab, position, client_id) {\n    Ok(effect) => effect,\n    Err(e) => {\n        log::debug!(\"mouse action {action:?} skipped: {e:#}\");\n        MouseEffect::default()\n    },\n}","preventionTips":["Treat pane ids embedded in mouse state as ephemeral: valid only until the next layout change","Discard in-flight drag/selection state when a pane-close or layout event arrives","For tests injecting mouse events, re-derive pane positions after every layout mutation"],"tags":["rust","zellij","mouse","selection","stale-id"],"backgroundTag":null,"analyzedSha":"98a0837077492d53dd252ab30bc3e43e41e504f4","analyzedAt":"2026-08-16T13:02:01.396Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}