{"record":{"id":"deed56555c0b266e","repo":"zed-industries/zed","slug":"screen-share-failed-deed56","errorCode":null,"errorMessage":"Screen share failed","messagePattern":"Screen share failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_macos/src/screen_capture.rs","lineNumber":277,"sourceCode":"                // SAFETY: Marked unsafe conservatively by objc2\n                let result = unsafe { content.displays() }\n                    .into_iter()\n                    .map(|display| {\n                        // SAFETY: Marked unsafe conservatively by objc2\n                        let id = unsafe { display.displayID() };\n                        let metadata = screen_id_to_label.get(&id).cloned();\n                        let source = MacScreenCaptureSource {\n                            sc_display: display,\n                            meta: metadata,\n                        };\n                        Rc::new(source) as Rc<dyn ScreenCaptureSource>\n                    })\n                    .collect::<Vec<_>>();\n\n                Ok(result)\n            } else {\n                // The two pointers are mutually exclusive, this should never happen\n                Err(anyhow!(\"Screen share failed\"))\n            };\n\n            _ = tx.send(result);\n        },\n    );\n\n    unsafe {\n        SCShareableContent::getShareableContentExcludingDesktopWindows_onScreenWindowsOnly_completionHandler(true, true, &handler);\n    }\n\n    rx\n}\n\n#[ctor(unsafe)]\nunsafe fn build_classes() {\n    let mut decl = ClassDecl::new(\"GPUIStreamDelegate\", class!(NSObject)).unwrap();\n    unsafe {\n        decl.add_method(","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_macos/src/screen_capture.rs#L259-L295","documentation":"In get_sources, the SCShareableContent completion handler receives mutually exclusive content/error pointers. If neither is present (both null), the code concludes the callback is in an impossible state and returns this bare error. The comment notes the two pointers are mutually exclusive, so this path should never occur in practice.","triggerScenarios":"The ScreenCaptureKit completion callback fires with both the SCShareableContent pointer and the NSError pointer null — a defensive catch-all for a malformed/inconsistent ScreenCaptureKit response.","commonSituations":"Potential ScreenCaptureKit framework bugs or edge cases in unusual session states; theoretically unreachable in normal operation; encountered only if macOS violates its documented callback contract.","solutions":["Retry get_sources; a one-off malformed callback usually succeeds on retry.","Grant Screen Recording permission and retry, since odd framework states often stem from permission gaps.","Update macOS — ScreenCaptureKit behavior bugs are fixed in point releases.","If reproducible, file a bug with Apple including the macOS version and repro steps."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match get_sources() {\n    Err(e) if e.to_string() == \"Screen share failed\" => {\n        // Should be unreachable; retry once and report if it persists\n        match get_sources() {\n            Ok(v) => Ok(v),\n            Err(e2) => { report_screencapturekit_bug(e2); Err(e2) }\n        }\n    }\n    other => other,\n}","preventionTips":["Treat this as a ScreenCaptureKit contract violation; retry once and escalate if persistent.","Keep macOS updated so known ScreenCaptureKit bugs are patched.","Grant Screen Recording permission first to avoid odd framework states.","Log macOS version and repro details when this fires to support a framework bug report."],"tags":["macos","screen-capture","screencapturekit","gpui","invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-09-12T19:35:53.743Z","contentChangedAt":"2026-09-12T19:35:53.743Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}