zed-industries/zed · error

Cannot register URL scheme until app is installed

Error message

Cannot register URL scheme until app is installed

What it means

Guard in register_url_scheme: NSWorkspace.URLForApplicationWithBundleIdentifier returned nil — the bundle identifier exists but the application is not actually installed at a location Launch Services knows (common right after building but before copying to /Applications).

Source

Thrown at crates/gpui_macos/src/platform.rs:780

    fn register_url_scheme(&self, scheme: &str) -> Task<anyhow::Result<()>> {
        use objc2_foundation::{NSBundle, NSError, NSString};

        // API only available post Monterey
        // https://developer.apple.com/documentation/appkit/nsworkspace/3753004-setdefaultapplicationaturl
        let (done_tx, done_rx) = oneshot::channel();
        if Self::os_version() < Version::new(12, 0, 0) {
            return Task::ready(Err(anyhow!(
                "macOS 12.0 or later is required to register URL schemes"
            )));
        }

        let Some(bundle_id) = NSBundle::mainBundle().bundleIdentifier() else {
            return Task::ready(Err(anyhow!("Can only register URL scheme in bundled apps")));
        };

        let workspace = NSWorkspace::sharedWorkspace();
        let Some(app) = workspace.URLForApplicationWithBundleIdentifier(&bundle_id) else {
            return Task::ready(Err(anyhow!(
                "Cannot register URL scheme until app is installed"
            )));
        };

        let scheme = NSString::from_str(scheme);

        let done_tx = Cell::new(Some(done_tx));
        let handler = RcBlock::new(move |error: *mut NSError| {
            let result = if let Some(error) = unsafe { error.as_ref() } {
                Err(anyhow!(
                    "Failed to register: {}",
                    error.localizedDescription()
                ))
            } else {
                Ok(())
            };

            if let Some(done_tx) = done_tx.take() {

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Install/copy the app to /Applications (or register its location with Launch Services) before registering schemes
  2. Re-register with lsregister if the app was moved and Launch Services state is stale
  3. Retry registration after the app is confirmed present at its registered path
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/gpui_macos/src/platform.rs:748 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-09-12). Data as JSON: /api/errors/766fb8aec7f6584a. Report an issue: GitHub.