zed-industries/zed · error

Operator popped when no operator was on the stack. This like

Error message

Operator popped when no operator was on the stack. This likely means there is an invalid keymap config

What it means

Vim's pop_operator asserts the operator stack is non-empty when popping. An empty stack means keymap bindings dispatched an operator-consuming action without a preceding operator — usually a custom keymap misconfiguration.

Source

Thrown at crates/vim/src/vim.rs:1792

        self.sync_vim_settings(window, cx)
    }

    fn select_register(&mut self, register: Arc<str>, window: &mut Window, cx: &mut Context<Self>) {
        if register.chars().count() == 1 {
            self.selected_register
                .replace(register.chars().next().unwrap());
        }
        self.operator_stack.clear();
        self.sync_vim_settings(window, cx);
    }

    fn maybe_pop_operator(&mut self) -> Option<Operator> {
        self.operator_stack.pop()
    }

    fn pop_operator(&mut self, window: &mut Window, cx: &mut Context<Self>) -> Operator {
        let popped_operator = self.operator_stack.pop()
            .expect("Operator popped when no operator was on the stack. This likely means there is an invalid keymap config");
        self.sync_vim_settings(window, cx);
        popped_operator
    }

    fn clear_operator(&mut self, window: &mut Window, cx: &mut Context<Self>) {
        if matches!(self.active_operator(), Some(Operator::HelixJump { .. })) {
            self.clear_helix_jump_ui(window, cx);
        }
        Vim::take_count(cx);
        Vim::take_forced_motion(cx);
        self.selected_register.take();
        self.operator_stack.clear();
        self.sync_vim_settings(window, cx);
    }

    fn clear_helix_jump_ui(&mut self, _window: &mut Window, cx: &mut Context<Self>) {
        self.update_editor(cx, move |_, editor, cx| {
            editor.clear_navigation_overlays(HELIX_JUMP_OVERLAY_KEY, cx);

View on GitHub (pinned to f4178619ac)

Solutions

  1. Fix the custom keymap so operator actions are bound consistently
  2. Guard pop_operator to return a default operator when the stack is empty
  3. Clear or resync operator state on mode changes
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/vim/src/vim.rs:1792 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/e8238dfd26c0b1a0. Report an issue: GitHub.