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

TogglePaneEmbedOrFloatingByPaneId missing pane_id

Error message

TogglePaneEmbedOrFloatingByPaneId missing pane_id

What it means

TogglePaneEmbedOrFloatingByPaneId switches one specific pane between embedded and floating state. The protobuf message TogglePaneEmbedOrFloatingByPaneIdAction carries a single optional pane_id which the internal Action requires. A message with pane_id unset fails conversion with 'TogglePaneEmbedOrFloatingByPaneId missing pane_id'.

Source

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

                        .pane_id
                        .ok_or_else(|| anyhow!("ToggleFullscreenByPaneId missing pane_id"))?
                        .try_into()?,
                },
            ),
            ActionType::ToggleNoUiFullscreenByPaneId(a) => Ok(
                crate::input::actions::Action::ToggleFocusNoUiFullscreenByPaneId {
                    pane_id: a
                        .pane_id
                        .ok_or_else(|| anyhow!("ToggleNoUiFullscreenByPaneId missing pane_id"))?
                        .try_into()?,
                },
            ),
            ActionType::TogglePaneEmbedOrFloatingByPaneId(a) => Ok(
                crate::input::actions::Action::TogglePaneEmbedOrFloatingByPaneId {
                    pane_id: a
                        .pane_id
                        .ok_or_else(|| {
                            anyhow!("TogglePaneEmbedOrFloatingByPaneId missing pane_id")
                        })?
                        .try_into()?,
                },
            ),
            ActionType::CloseFocusByPaneId(a) => {
                Ok(crate::input::actions::Action::CloseFocusByPaneId {
                    pane_id: a
                        .pane_id
                        .ok_or_else(|| anyhow!("CloseFocusByPaneId missing pane_id"))?
                        .try_into()?,
                })
            },
            ActionType::RenamePaneByPaneId(a) => {
                Ok(crate::input::actions::Action::RenamePaneByPaneId {
                    pane_id: a.pane_id.map(|p| p.try_into()).transpose()?,
                    name: a.name,
                })
            },

View on GitHub (pinned to 98a0837077)

Solutions

  1. Set pane_id: Some(PaneId { pane_type: Some(PaneType::Terminal(id)) }) before dispatch.
  2. Use the plain TogglePaneEmbedOrFloating action for the focused pane.
  3. Resolve and validate the pane id (terminal vs plugin) before building the message.
  4. Keep zellij client, server, and plugins version-aligned.

Example fix

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

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

Strategy: validation

Validate before calling

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

Type guard

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

Prevention

When it happens

Trigger: Sending ActionType::TogglePaneEmbedOrFloatingByPaneId while TogglePaneEmbedOrFloatingByPaneIdAction.pane_id is None.

Common situations: Plugins managing floating panes programmatically; hand-built action structs; version mismatch between client and server contracts; intending the focused-pane TogglePaneEmbedOrFloating variant.

Related errors


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