zed-industries/zed · error

Is an editor

Error message

Is an editor

What it means

toggle_soft_wrap expects the active searchable item to be an editor (it downcasts via act_as_type(Editor) and asserts success); a non-editor searchable item (or a broken registration) triggers this panic while relaying the soft-wrap toggle.

Source

Thrown at crates/search/src/buffer_search.rs:1017

        let Some(item) = &self.active_searchable_item else {
            return;
        };
        // A split diff editor picks which side to toggle and keeps both sides
        // in sync, while its `act_as_type(Editor)` only exposes the RHS
        // editor, so relay to the split editor itself when it is split.
        if let Some(split_editor) = item.act_as_type(TypeId::of::<SplittableEditor>(), cx) {
            let split_editor = split_editor
                .downcast::<SplittableEditor>()
                .expect("Is a splittable editor");
            if split_editor.read(cx).is_split() {
                split_editor.update(cx, |split_editor, cx| {
                    split_editor.toggle_soft_wrap(action, window, cx)
                });
                return;
            }
        }
        if let Some(item) = item.act_as_type(TypeId::of::<Editor>(), cx) {
            let editor = item.downcast::<Editor>().expect("Is an editor");
            editor.update(cx, |editor, cx| editor.toggle_soft_wrap(action, window, cx));
        }
    }

    fn toggle_fold_all_in_item(&self, window: &mut Window, cx: &mut Context<Self>) {
        if let Some(item) = &self.active_searchable_item {
            if let Some(item) = item.act_as_type(TypeId::of::<Editor>(), cx) {
                let editor = item.downcast::<Editor>().expect("Is an editor");
                editor.update(cx, |editor, cx| {
                    let is_collapsed = editor.has_any_buffer_folded(cx);
                    if is_collapsed {
                        editor.unfold_all(&UnfoldAll, window, cx);
                    } else {
                        editor.fold_all(&FoldAll, window, cx);
                    }
                })
            }
        }

View on GitHub (pinned to f4178619ac)

Solutions

  1. Check act_as_type registration for the active searchable item
  2. Skip soft-wrap relay for non-editor items
  3. Return early or log instead of asserting on item type
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/search/src/buffer_search.rs:1017 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/176d753fe399bd17. Report an issue: GitHub.