{"record":{"id":"34b40c1feca5657d","repo":"zed-industries/zed","slug":"can-t-call-scapdefaulttargetcapturesource-stream","errorCode":null,"errorMessage":"Can't call ScapDefaultTargetCaptureSource::stream multiple times.","messagePattern":"Can't call ScapDefaultTargetCaptureSource::stream multiple times\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui/src/platform/scap_screen_capture.rs","lineNumber":191,"sourceCode":"            resolution: self.size,\n            label: None,\n            is_main: None,\n            id: self.target.id as u64,\n        })\n    }\n\n    fn stream(\n        &self,\n        foreground_executor: &ForegroundExecutor,\n        frame_callback: Box<dyn Fn(ScreenCaptureFrame) + Send>,\n    ) -> oneshot::Receiver<Result<Box<dyn ScreenCaptureStream>>> {\n        let (tx, rx) = oneshot::channel();\n        match self.stream_call_tx.try_send((tx, frame_callback)) {\n            Ok(()) => {}\n            Err(std::sync::mpsc::TrySendError::Full((tx, _)))\n            | Err(std::sync::mpsc::TrySendError::Disconnected((tx, _))) => {\n                // Note: support could be added for being called again after end of prior stream.\n                tx.send(Err(anyhow!(\n                    \"Can't call ScapDefaultTargetCaptureSource::stream multiple times.\"\n                )))\n                .ok();\n            }\n        }\n        to_dyn_screen_capture_stream(rx, foreground_executor)\n    }\n}\n\nfn new_scap_capturer(target: Option<scap::Target>) -> Result<scap::capturer::Capturer> {\n    scap::capturer::Capturer::build(scap::capturer::Options {\n        fps: 60,\n        show_cursor: true,\n        show_highlight: true,\n        // Note that the actual frame output type may differ.\n        output_type: scap::frame::FrameType::YUVFrame,\n        output_resolution: scap::capturer::Resolution::Captured,\n        crop_area: None,","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/gpui/src/platform/scap_screen_capture.rs#L173-L209","documentation":"Assertion in ScapDefaultTargetCaptureSource::stream: a second stream was requested while one already exists (the one-shot channel was closed after the first call). The scap screen-capture source supports only a single active stream per target.","triggerScenarios":"Thrown at crates/gpui/src/platform/scap_screen_capture.rs:191 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create a new ScapDefaultTargetCaptureSource for each capture session instead of reusing one","Stop the previous stream and wait for it to fully tear down before calling stream again","Guard call sites so only one stream is started per capture source"],"exampleFix":null,"handlingStrategy":"validation","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-14T00:17:10.932Z"}