zed-industries/zed · error
main thread message channel, extension {name} (id {id})
Error message
main thread message channel, extension {name} (id {id}) What it means
The return half of the extension main-thread handshake: after posting work, the extension awaits a oneshot receiver for the result. If the main thread dropped the closure without sending a reply (the app quit mid-call), the oneshot sender is destroyed, `await` errors, and the extension panics with the extension name and id.
Source
Thrown at crates/extension_host/src/wasm_host.rs:968
let (return_tx, return_rx) = oneshot::channel();
self.host
.main_thread_message_tx
.clone()
.unbounded_send(Box::new(move |cx| {
async {
let result = f(cx).await;
return_tx.send(result).ok();
}
.boxed_local()
}))
.unwrap_or_else(|_| {
panic!(
"main thread message channel should not be closed yet, extension {} (id {})",
self.manifest.name, self.manifest.id,
)
});
let name = self.manifest.name.clone();
let id = self.manifest.id.clone();
async move {
return_rx.await.unwrap_or_else(|_| {
panic!("main thread message channel, extension {name} (id {id})")
})
}
}
fn work_dir(&self) -> PathBuf {
self.host.work_dir.join(self.manifest.id.as_ref())
}
fn extension_error(&self, message: String) -> anyhow::Error {
anyhow!(
"from extension \"{}\" version {}: {}",
self.manifest.name,
self.manifest.version,
message
)View on GitHub (pinned to 5a9b9558db)
Solutions
- Update Zed — the host should stop dispatching extension work before dropping the main-thread channel; such races are fixed upstream
- Extension authors: make deactivate cancel in-flight tasks so nothing is left awaiting main-thread replies during quit
- Report with the extension name/id from the message and the exact quit sequence that triggers it
Defensive patterns
Strategy: fallback
Prevention
- Make deactivate cancel tasks awaiting main-thread results so quit cannot strand them
- Avoid fire-and-forget API calls right before app exit
- Report reproducible 'quit while extension active' sequences with the extension name/id from the message
When it happens
Trigger: App shutdown occurring while an extension is awaiting the result of a main-thread API call — the posted closure never runs, so no result is ever sent.
Common situations: Quitting Zed while an extension has an in-flight command or API request; races during rapid window close; extension tasks that outlive deactivate.
Related errors
- main thread message channel should not be closed yet, extens
- blocking sender returned without value
- row out of range
- invalid display row {}
- anchor's path was never added to multibuffer
AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20).
Data as JSON: /api/errors/85cd3478252cd842.
Report an issue: GitHub.