zellij-org/zellij · error · anyhow::Error

TogglePanePinnedByPaneId missing pane_id

Error message

TogglePanePinnedByPaneId missing pane_id

What it means

TogglePanePinnedByPaneId toggles the pinned state of one specific pane (pinned panes are not auto-closed by relayout). Its protobuf message TogglePanePinnedByPaneIdAction carries one optional pane_id which the internal Action requires. With pane_id = None the conversion fails with 'TogglePanePinnedByPaneId missing pane_id'.

Source

Thrown at zellij-utils/src/ipc/protobuf_conversion.rs:3079

            ActionType::RenamePaneByPaneId(a) => {
                Ok(crate::input::actions::Action::RenamePaneByPaneId {
                    pane_id: a.pane_id.map(|p| p.try_into()).transpose()?,
                    name: a.name,
                })
            },
            ActionType::UndoRenamePaneByPaneId(a) => {
                Ok(crate::input::actions::Action::UndoRenamePaneByPaneId {
                    pane_id: a
                        .pane_id
                        .ok_or_else(|| anyhow!("UndoRenamePaneByPaneId missing pane_id"))?
                        .try_into()?,
                })
            },
            ActionType::TogglePanePinnedByPaneId(a) => {
                Ok(crate::input::actions::Action::TogglePanePinnedByPaneId {
                    pane_id: a
                        .pane_id
                        .ok_or_else(|| anyhow!("TogglePanePinnedByPaneId missing pane_id"))?
                        .try_into()?,
                })
            },
            ActionType::FocusPaneByPaneId(a) => {
                Ok(crate::input::actions::Action::FocusPaneByPaneId {
                    pane_id: a
                        .pane_id
                        .ok_or_else(|| anyhow!("FocusPaneByPaneId missing pane_id"))?
                        .try_into()?,
                })
            },
            // Tab-targeting CLI-only variants
            ActionType::UndoRenameTabByTabId(a) => {
                Ok(crate::input::actions::Action::UndoRenameTabByTabId { id: a.id })
            },
            ActionType::ToggleActiveSyncTabByTabId(a) => {
                Ok(crate::input::actions::Action::ToggleActiveSyncTabByTabId { id: a.id })
            },

View on GitHub (pinned to 98a0837077)

Solutions

  1. Set pane_id: Some(PaneId { pane_type: Some(PaneType::Terminal(id)) }).
  2. Use the plain TogglePanePinned action for the focused pane.
  3. Validate the pane id exists before constructing the message.
  4. Rebuild senders against the same zellij tag as the server.

Example fix

// before
let action = ActionType::TogglePanePinnedByPaneId(
    TogglePanePinnedByPaneIdAction { pane_id: None },
); // -> "TogglePanePinnedByPaneId missing pane_id"

// after
let action = ActionType::TogglePanePinnedByPaneId(
    TogglePanePinnedByPaneIdAction {
        pane_id: Some(PaneId { pane_type: Some(PaneType::Terminal(1)) }),
    },
);
Defensive patterns

Strategy: validation

Validate before calling

fn is_sendable(a: &TogglePanePinnedByPaneIdAction) -> bool {
    a.pane_id
        .as_ref()
        .and_then(|p| p.pane_type.as_ref())
        .is_some()
}

Type guard

fn has_valid_pane_id(a: &TogglePanePinnedByPaneIdAction) -> 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("TogglePanePinnedByPaneId missing pane_id") => {
        log::warn!("pin toggle without pane target: {e}");
    },
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Sending ActionType::TogglePanePinnedByPaneId while TogglePanePinnedByPaneIdAction.pane_id is None.

Common situations: Automation pinning panes during layout changes; hand-built prost messages; contract version mismatch; meaning to use the focused-pane TogglePanePinned variant.

Related errors


AI-assisted analysis of zellij-org/zellij@98a0837077 (2026-08-16). Data as JSON: /api/errors/da68d071ec2d0655. Report an issue: GitHub.