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

No tabs left, cannot move clients

Error message

No tabs left, cannot move clients: {:?} from closed tab

What it means

Error "No tabs left, cannot move clients: {:?} from closed tab" thrown in zellij-org/zellij.

Solutions

  1. Ensure at least one tab exists before attaching or moving clients.
  2. Verify the tab index/name is valid with `zellij action query-tab-names`.

When it happens

Trigger: Occurs at zellij-server/src/screen.rs:1848 when the operation fails: "No tabs left, cannot move clients: {:?} from closed tab". Currently there is no defensive handling preventing or contextualizing this failure before it surfaces.

Common situations: Race between tab close and a client attach/move action, or a stale tab index.


AI-assisted analysis of zellij-org/zellij@474ea0cef6 (2026-08-19). Data as JSON: /api/errors/17384d6587df7a76. Report an issue: GitHub.

Appendix: source

Thrown at zellij-server/src/screen.rs:1903

            .find(|t| t.position == position)
            .map(|t| t.id)
    }

    /// Gets the display position of the tab with the given ID.
    ///
    /// Use this to convert ID → position for user-facing operations.
    fn get_tab_position_by_id(&self, id: usize) -> Option<usize> {
        self.tabs.get(&id).map(|t| t.position)
    }

    fn move_clients_from_closed_tab(
        &mut self,
        client_ids_and_mode_infos: Vec<(ClientId, ModeInfo)>,
    ) -> Result<()> {
        let err_context = || "failed to move clients from closed tab".to_string();

        if self.tabs.is_empty() {
            Err::<(), _>(anyhow!(
                "No tabs left, cannot move clients: {:?} from closed tab",
                client_ids_and_mode_infos
            ))
            .with_context(err_context)
            .non_fatal();

            return Ok(());
        }
        let first_tab_index = *self
            .tabs
            .keys()
            .next()
            .context("screen contained no tabs")
            .with_context(err_context)?;
        let mut arriving_client_ids: HashMap<usize, Vec<ClientId>> = HashMap::new();
        for (client_id, client_mode_info) in client_ids_and_mode_infos {
            let client_tab_history = self.tab_history.entry(client_id).or_insert_with(Vec::new);
            if let Some(client_previous_tab) = client_tab_history.pop() {

View on GitHub (pinned to 474ea0cef6)