zed-industries/zed · error · anyhow::Error

wasm extension channel should not be closed yet, extension {

Error message

wasm extension channel should not be closed yet, extension {} (id {})

What it means

ExtensionWorker::call tried to schedule a closure onto the extension's event loop but the unbounded channel to that extension's thread is already closed. This indicates the wasm extension's worker thread has shut down (crashed or the extension was unloaded) while the host still held a handle — the caller's request can never run, so it fails with this sentinel naming the extension and its id.

Source

Thrown at crates/extension_host/src/wasm_host.rs:926

        })
        .await
    }

    pub async fn call<T, Fn>(&self, f: Fn) -> Result<T>
    where
        T: 'static + Send,
        Fn: 'static
            + Send
            + for<'a> FnOnce(&'a mut Extension, &'a mut Store<WasmState>) -> BoxFuture<'a, T>,
    {
        let (return_tx, return_rx) = oneshot::channel();
        self.tx
            .unbounded_send(Box::new(move |extension, store| {
                async {
                    let result = f(extension, store).await;
                    return_tx.send(result).ok();
                }
                .boxed()
            }))
            .map_err(|_| {
                anyhow!(
                    "wasm extension channel should not be closed yet, extension {} (id {})",
                    self.manifest.name,
                    self.manifest.id,
                )
            })?;
        return_rx.await.with_context(|| {
            format!(
                "wasm extension channel, extension {} (id {})",
                self.manifest.name, self.manifest.id,
            )
        })
    }
}

impl WasmState {

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Treat the extension as dead: drop cached handles, mark it failed, and surface an 'extension crashed' state in UI
  2. Reinstall or update the extension if its wasm code panics deterministically on load
  3. Avoid keeping worker handles past unload — subscribe to extension lifecycle events to invalidate them
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/extension_host/src/wasm_host.rs:889 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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