zed-industries/zed · error
screen was already shared
Error message
screen was already shared
What it means
Room::share_screen was called while a screen track is already being published (is_sharing_screen returned true); the guard prevents publishing a second screen track for the same room, and the sentinel error signals the duplicate request rather than any capture failure.
Solutions
- Stop the current screen share before starting a new one
- Reuse the existing screen track instead of publishing another
- Disable the share-screen UI action while a share is active
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/call/src/call_impl/room.rs:1485 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/bf0fb7e09b595fdf.
Report an issue: GitHub.
Appendix: source
Thrown at crates/call/src/call_impl/room.rs:1485
cx.notify();
Err(error)
}
}
}
})?
})
}
pub fn share_screen(
&mut self,
source: Rc<dyn ScreenCaptureSource>,
cx: &mut Context<Self>,
) -> Task<Result<()>> {
if self.status.is_offline() {
return Task::ready(Err(anyhow!("room is offline")));
}
if self.is_sharing_screen() {
return Task::ready(Err(anyhow!("screen was already shared")));
}
let (participant, publish_id) = if let Some(live_kit) = self.live_kit.as_mut() {
let publish_id = post_inc(&mut live_kit.next_publish_id);
live_kit.screen_track = LocalTrack::Pending { publish_id };
cx.notify();
(live_kit.room.local_participant(), publish_id)
} else {
return Task::ready(Err(anyhow!("live-kit was not initialized")));
};
cx.spawn(async move |this, cx| {
let publication = participant.publish_screenshare_track(&*source, cx).await;
this.update(cx, |this, cx| {
let live_kit = this
.live_kit
.as_mut()View on GitHub (pinned to f4178619ac)