{"record":{"id":"4c36816cf99fc7be","repo":"zed-industries/zed","slug":"macos-12-0-or-later-is-required-to-register-url-sc","errorCode":null,"errorMessage":"macOS 12.0 or later is required to register URL schemes","messagePattern":"macOS 12\\.0 or later is required to register URL schemes","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_macos/src/platform.rs","lineNumber":729,"sourceCode":"    fn open_url(&self, url: &str) {\n        unsafe {\n            let ns_url = NSURL::alloc(nil).initWithString_(ns_string(url));\n            if ns_url.is_null() {\n                log::error!(\"Failed to create NSURL from string: {}\", url);\n                return;\n            }\n            let url = ns_url.autorelease();\n            let workspace: id = msg_send![class!(NSWorkspace), sharedWorkspace];\n            msg_send![workspace, openURL: url]\n        }\n    }\n\n    fn register_url_scheme(&self, scheme: &str) -> Task<anyhow::Result<()>> {\n        // API only available post Monterey\n        // https://developer.apple.com/documentation/appkit/nsworkspace/3753004-setdefaultapplicationaturl\n        let (done_tx, done_rx) = oneshot::channel();\n        if Self::os_version() < Version::new(12, 0, 0) {\n            return Task::ready(Err(anyhow!(\n                \"macOS 12.0 or later is required to register URL schemes\"\n            )));\n        }\n\n        let bundle_id = unsafe {\n            let bundle: id = msg_send![class!(NSBundle), mainBundle];\n            let bundle_id: id = msg_send![bundle, bundleIdentifier];\n            if bundle_id == nil {\n                return Task::ready(Err(anyhow!(\"Can only register URL scheme in bundled apps\")));\n            }\n            bundle_id\n        };\n\n        unsafe {\n            let workspace: id = msg_send![class!(NSWorkspace), sharedWorkspace];\n            let scheme: id = ns_string(scheme);\n            let app: id = msg_send![workspace, URLForApplicationWithBundleIdentifier: bundle_id];\n            if app == nil {","sourceCodeStart":711,"sourceCodeEnd":747,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/gpui_macos/src/platform.rs#L711-L747","documentation":"Guard in register_url_scheme: the macOS version check (Version::new(12,0,0)) failed because NSWorkspace.setDefaultApplicationAtURL(toURL:contentType:) is only available from macOS 12 (Monterey). The API is invoked unconditionally otherwise, so the guard rejects older systems up front.","triggerScenarios":"Thrown at crates/gpui_macos/src/platform.rs:729 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Gate the register-url-scheme feature behind a macOS 12 availability check in the UI","On older macOS, fall back to directing users to change the default handler manually","Use ProcessInfo.operatingSystemVersion (as here) rather than weak-linked symbols to decide availability"],"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-14T05:17:10.506Z"}