zed-industries/zed · error

Is a splittable editor

Error message

Is a splittable editor

What it means

toggle_soft_wrap expects the active searchable item to expose itself as a splittable editor; the act_as_type lookup succeeded but downcast to SplittableEditor failed, a type-registration inconsistency in the searchable item implementation.

Source

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

    // The query editor is an editor itself and would otherwise swallow this
    // action without any visible effect, so relay it to the searched editor
    // while keeping the focus in the search bar.
    fn toggle_soft_wrap(
        &mut self,
        action: &ToggleSoftWrap,
        window: &mut Window,
        cx: &mut Context<Self>,
    ) {
        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| {

View on GitHub (pinned to f4178619ac)

Solutions

  1. Ensure the item registers itself as SplittableEditor consistently with what act_as_type returns
  2. Use a checked conversion that returns Option instead of expect
  3. Verify the active item type supports the soft-wrap relay
Defensive patterns

Strategy: type-guard

When it happens

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