{"record":{"id":"3097dc7feea22da2","repo":"zed-industries/zed","slug":"live-kit-was-not-initialized","errorCode":null,"errorMessage":"live-kit was not initialized","messagePattern":"live-kit was not initialized","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/call/src/call_impl/room.rs","lineNumber":1494,"sourceCode":"    pub fn share_screen(\n        &mut self,\n        source: Rc<dyn ScreenCaptureSource>,\n        cx: &mut Context<Self>,\n    ) -> Task<Result<()>> {\n        if self.status.is_offline() {\n            return Task::ready(Err(anyhow!(\"room is offline\")));\n        }\n        if self.is_sharing_screen() {\n            return Task::ready(Err(anyhow!(\"screen was already shared\")));\n        }\n\n        let (participant, publish_id) = if let Some(live_kit) = self.live_kit.as_mut() {\n            let publish_id = post_inc(&mut live_kit.next_publish_id);\n            live_kit.screen_track = LocalTrack::Pending { publish_id };\n            cx.notify();\n            (live_kit.room.local_participant(), publish_id)\n        } else {\n            return Task::ready(Err(anyhow!(\"live-kit was not initialized\")));\n        };\n\n        cx.spawn(async move |this, cx| {\n            let publication = participant.publish_screenshare_track(&*source, cx).await;\n\n            this.update(cx, |this, cx| {\n                let live_kit = this\n                    .live_kit\n                    .as_mut()\n                    .context(\"live-kit was not initialized\")?;\n\n                let canceled = if let LocalTrack::Pending {\n                    publish_id: cur_publish_id,\n                } = &live_kit.screen_track\n                {\n                    *cur_publish_id != publish_id\n                } else {\n                    true","sourceCodeStart":1476,"sourceCodeEnd":1512,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/call/src/call_impl/room.rs#L1476-L1512","documentation":"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.","triggerScenarios":"Thrown at crates/call/src/call_impl/room.rs:1494 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Establish the LiveKit connection before sharing the screen (join the call's media room first)","Retry after the room finishes connecting to LiveKit","If LiveKit is unavailable, fall back to informing the user that screen sharing is disabled for this room"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}