{"record":{"id":"f31d3069742027eb","repo":"zed-industries/zed","slug":"can-only-register-url-scheme-in-bundled-apps","errorCode":null,"errorMessage":"Can only register URL scheme in bundled apps","messagePattern":"Can only register URL scheme in bundled apps","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_macos/src/platform.rs","lineNumber":775,"sourceCode":"            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        use objc2_foundation::{NSBundle, NSError, NSString};\n\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 Some(bundle_id) = NSBundle::mainBundle().bundleIdentifier() else {\n            return Task::ready(Err(anyhow!(\"Can only register URL scheme in bundled apps\")));\n        };\n\n        let workspace = NSWorkspace::sharedWorkspace();\n        let Some(app) = workspace.URLForApplicationWithBundleIdentifier(&bundle_id) else {\n            return Task::ready(Err(anyhow!(\n                \"Cannot register URL scheme until app is installed\"\n            )));\n        };\n\n        let scheme = NSString::from_str(scheme);\n\n        let done_tx = Cell::new(Some(done_tx));\n        let handler = RcBlock::new(move |error: *mut NSError| {\n            let result = if let Some(error) = unsafe { error.as_ref() } {\n                Err(anyhow!(\n                    \"Failed to register: {}\",\n                    error.localizedDescription()\n                ))","sourceCodeStart":757,"sourceCodeEnd":793,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_macos/src/platform.rs#L757-L793","documentation":"Guard in register_url_scheme: NSBundle.mainBundle.bundleIdentifier returned nil, meaning the process is not running inside an .app bundle (e.g. launched via cargo run or a bare binary), so there is no bundle identity to register as the default handler.","triggerScenarios":"Thrown at crates/gpui_macos/src/platform.rs:738 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Package the app as a proper .app bundle with a CFBundleIdentifier before offering scheme registration","In dev builds, skip or hide the URL-scheme registration feature","Report the limitation to the caller so it can show guidance instead of silently failing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}