zed-industries/zed · error
Can't call ScapDefaultTargetCaptureSource::stream multiple t
Error message
Can't call ScapDefaultTargetCaptureSource::stream multiple times.
What it means
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.
Source
Thrown at crates/gpui/src/platform/scap_screen_capture.rs:191
resolution: self.size,
label: None,
is_main: None,
id: self.target.id as u64,
})
}
fn stream(
&self,
foreground_executor: &ForegroundExecutor,
frame_callback: Box<dyn Fn(ScreenCaptureFrame) + Send>,
) -> oneshot::Receiver<Result<Box<dyn ScreenCaptureStream>>> {
let (tx, rx) = oneshot::channel();
match self.stream_call_tx.try_send((tx, frame_callback)) {
Ok(()) => {}
Err(std::sync::mpsc::TrySendError::Full((tx, _)))
| Err(std::sync::mpsc::TrySendError::Disconnected((tx, _))) => {
// Note: support could be added for being called again after end of prior stream.
tx.send(Err(anyhow!(
"Can't call ScapDefaultTargetCaptureSource::stream multiple times."
)))
.ok();
}
}
to_dyn_screen_capture_stream(rx, foreground_executor)
}
}
fn new_scap_capturer(target: Option<scap::Target>) -> Result<scap::capturer::Capturer> {
scap::capturer::Capturer::build(scap::capturer::Options {
fps: 60,
show_cursor: true,
show_highlight: true,
// Note that the actual frame output type may differ.
output_type: scap::frame::FrameType::YUVFrame,
output_resolution: scap::capturer::Resolution::Captured,
crop_area: None,View on GitHub (pinned to f4178619ac)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/gpui/src/platform/scap_screen_capture.rs:191 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/34b40c1feca5657d.
Report an issue: GitHub.