zellij-org/zellij · error · anyhow::Error
ClearScreenByPaneId missing pane_id
Error message
ClearScreenByPaneId missing pane_id
What it means
ClearScreenByPaneId clears the screen of one specific pane. Its protobuf message ClearScreenByPaneIdAction has one optional pane_id field which the internal Action requires. If the message arrives with pane_id = None, conversion fails with 'ClearScreenByPaneId missing pane_id' and the clear never runs.
Source
Thrown at zellij-utils/src/ipc/protobuf_conversion.rs:3014
.pane_id
.ok_or_else(|| anyhow!("MovePaneByPaneId missing pane_id"))?
.try_into()?,
direction,
})
},
ActionType::MovePaneBackwardsByPaneId(a) => {
Ok(crate::input::actions::Action::MovePaneBackwardsByPaneId {
pane_id: a
.pane_id
.ok_or_else(|| anyhow!("MovePaneBackwardsByPaneId missing pane_id"))?
.try_into()?,
})
},
ActionType::ClearScreenByPaneId(a) => {
Ok(crate::input::actions::Action::ClearScreenByPaneId {
pane_id: a
.pane_id
.ok_or_else(|| anyhow!("ClearScreenByPaneId missing pane_id"))?
.try_into()?,
})
},
ActionType::EditScrollbackByPaneId(a) => {
Ok(crate::input::actions::Action::EditScrollbackByPaneId {
pane_id: a
.pane_id
.ok_or_else(|| anyhow!("EditScrollbackByPaneId missing pane_id"))?
.try_into()?,
ansi: a.ansi,
})
},
ActionType::ToggleFullscreenByPaneId(a) => Ok(
crate::input::actions::Action::ToggleFocusFullscreenByPaneId {
pane_id: a
.pane_id
.ok_or_else(|| anyhow!("ToggleFullscreenByPaneId missing pane_id"))?
.try_into()?,View on GitHub (pinned to 98a0837077)
Solutions
- Set pane_id: Some(PaneId { pane_type: Some(PaneType::Terminal(id)) }) before sending.
- Use the plain Clear action for the focused pane.
- Keep both IPC ends on the same zellij version.
- Validate the assembled message with a shared helper before dispatch.
Example fix
// before
let action = ActionType::ClearScreenByPaneId(
ClearScreenByPaneIdAction { pane_id: None },
); // -> "ClearScreenByPaneId missing pane_id"
// after
let action = ActionType::ClearScreenByPaneId(
ClearScreenByPaneIdAction {
pane_id: Some(PaneId { pane_type: Some(PaneType::Terminal(1)) }),
},
); Defensive patterns
Strategy: validation
Validate before calling
fn is_sendable(a: &ClearScreenByPaneIdAction) -> bool {
a.pane_id
.as_ref()
.and_then(|p| p.pane_type.as_ref())
.is_some()
} Type guard
fn has_valid_pane_id(a: &ClearScreenByPaneIdAction) -> bool {
matches!(
a.pane_id.as_ref().and_then(|p| p.pane_type.as_ref()),
Some(pane_id::PaneType::Terminal(_)) | Some(pane_id::PaneType::Plugin(_))
)
} Try / catch
match Action::try_from(proto_action) {
Ok(action) => dispatch(action),
Err(e) if e.to_string().contains("ClearScreenByPaneId missing pane_id") => {
log::warn!("clear action without pane target: {e}");
},
Err(e) => return Err(e),
} Prevention
- Choose Clear for the focused pane unless you truly target another pane.
- Build per-pane commands from live pane metadata, not constants.
- Cover per-pane variants in your IPC fuzz or integration tests.
When it happens
Trigger: Sending ActionType::ClearScreenByPaneId with ClearScreenByPaneIdAction.pane_id unset (None).
Common situations: Plugins sending per-pane clear commands; hand-built action messages; client/server protobuf version mismatch; intending the focused-pane Clear variant.
Related errors
- PageScrollUpByPaneId missing pane_id
- PageScrollDownByPaneId missing pane_id
- HalfPageScrollUpByPaneId missing pane_id
- HalfPageScrollDownByPaneId missing pane_id
- ResizeByPaneId missing resize_action
AI-assisted analysis of zellij-org/zellij@98a0837077 (2026-08-16).
Data as JSON: /api/errors/36a6aa3fe05483d2.
Report an issue: GitHub.