zed-industries/zed · error
Screen share failed: {}
Error message
Screen share failed: {} What it means
get_sources in the macOS screen-capture implementation calls SCShareableContent.getCompletionHandler; if ScreenCaptureKit returns an NSError the localized description is wrapped as "Screen share failed: {description}". It means macOS could not enumerate shareable content (displays/windows) for screen sharing.
Source
Thrown at crates/gpui_macos/src/screen_capture.rs:254
map
}
pub(crate) fn get_sources(
marker: MainThreadMarker,
) -> oneshot::Receiver<Result<Vec<Rc<dyn ScreenCaptureSource>>>> {
let (tx, rx) = oneshot::channel();
let tx = Rc::new(RefCell::new(Some(tx)));
let screen_id_to_label = screen_id_to_human_label(marker);
let handler = RcBlock::new(
move |content: *mut SCShareableContent, error: *mut NSError| {
let Some(tx) = tx.borrow_mut().take() else {
return;
};
let result = if let Some(error) = unsafe { error.as_ref() } {
Err(anyhow!(
"Screen share failed: {}",
error.localizedDescription()
))
} else if let Some(content) = unsafe { content.as_ref() } {
// SAFETY: Marked unsafe conservatively by objc2
let result = unsafe { content.displays() }
.into_iter()
.map(|display| {
// SAFETY: Marked unsafe conservatively by objc2
let id = unsafe { display.displayID() };
let metadata = screen_id_to_label.get(&id).cloned();
let source = MacScreenCaptureSource {
sc_display: display,
meta: metadata,
};
Rc::new(source) as Rc<dyn ScreenCaptureSource>
})
.collect::<Vec<_>>();View on GitHub (pinned to 9d272b0363)
Solutions
- Grant Screen Recording permission to the app in System Settings > Privacy & Security > Screen Recording, then restart the app.
- Read the wrapped localizedDescription for the precise ScreenCaptureKit error.
- Confirm the app runs on macOS 12.3+ where ScreenCaptureKit exists.
- Reset TCC permissions for the app (tccutil reset ScreenCapture) and re-grant.
- Re-sign/reinstall the app if permission grants stopped matching after a rebuild (changing signature invalidates grants).
Defensive patterns
Strategy: try-catch
Validate before calling
// Check screen recording permission before requesting shareable content (macOS 15+)
// or probe via CGRequestScreenCaptureAccess on older versions
let permitted = unsafe { CGPreflightScreenCaptureAccess() }; Try / catch
match get_sources() {
Err(e) if e.to_string().starts_with("Screen share failed:") => {
if !unsafe { CGPreflightScreenCaptureAccess() } {
prompt_user_to_grant_screen_recording_permission();
} else {
log::error!("ScreenCaptureKit error: {e}");
}
}
other => other?,
} Prevention
- Pre-flight Screen Recording permission (CGPreflightScreenCaptureAccess) and guide users to System Settings.
- Require macOS 12.3+ before using ScreenCaptureKit-based APIs.
- Reset TCC (tccutil reset ScreenCapture) when grants stop applying after rebuilds/re-signs.
- Restart the app after the user grants permission; grants are not applied retroactively to running processes.
When it happens
Trigger: Requesting shareable content via get_sources when the SCShareableContent completion handler receives an error: missing Screen Recording permission, running on an unsupported macOS version, or ScreenCaptureKit failing internally.
Common situations: Screen Recording permission not granted (or revoked) in System Settings > Privacy & Security; running on macOS < 12.3 where ScreenCaptureKit is unavailable; TCC database inconsistencies after app updates or re-signing.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
- Screen share failed
- Failed to get active display list. Result: {result}
- error running osascript: {}
- RealtimeAudio priority should use spawn_realtime, not dispat
- Failed to register: {}
AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-09-12).
Data as JSON: /api/errors/2ec1ff44f14b52e3.
Report an issue: GitHub.