zed-industries/zed · error

live-kit was not initialized

Error message

live-kit was not initialized

What it means

Room::share_screen handled the case where live-kit is initialized by taking a publish id and registering a pending screen track; the complementary branch fires when self.live_kit is None — the room never established its LiveKit media session — so screen sharing is rejected because there is no media transport to publish the track on.

Solutions

  1. Establish the LiveKit connection before sharing the screen (join the call's media room first)
  2. Retry after the room finishes connecting to LiveKit
  3. If LiveKit is unavailable, fall back to informing the user that screen sharing is disabled for this room
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/call/src/call_impl/room.rs:1494 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/3097dc7feea22da2. Report an issue: GitHub.

Appendix: source

Thrown at crates/call/src/call_impl/room.rs:1494

    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()
                    .context("live-kit was not initialized")?;

                let canceled = if let LocalTrack::Pending {
                    publish_id: cur_publish_id,
                } = &live_kit.screen_track
                {
                    *cur_publish_id != publish_id
                } else {
                    true

View on GitHub (pinned to f4178619ac)