zed-industries/zed · error

app is not running inside a bundle

Error message

app is not running inside a bundle

What it means

Guard in app_path: the main bundle's bundleURL/path could not be resolved because the process is not running inside an .app bundle (a bare executable), so no application path exists to return. It is a sentinel for 'not a bundled macOS app', not a filesystem failure.

Source

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

    }

    fn on_system_notification_response(
        &self,
        callback: Box<dyn FnMut(gpui::SystemNotificationResponse)>,
    ) {
        let mut state = self.0.lock();
        let executor = state.foreground_executor.clone();
        state.system_notifications.on_response(&executor, callback);
    }

    fn keyboard_layout(&self) -> Box<dyn PlatformKeyboardLayout> {
        Box::new(MacKeyboardLayout::new())
    }

    fn keyboard_mapper(&self) -> Rc<dyn PlatformKeyboardMapper> {
        self.0.lock().keyboard_mapper.clone()
    }

    fn app_path(&self) -> Result<PathBuf> {
        unsafe {
            let bundle: id = NSBundle::mainBundle();
            anyhow::ensure!(!bundle.is_null(), "app is not running inside a bundle");
            Ok(path_from_objc(msg_send![bundle, bundlePath]))
        }
    }

    fn set_menus(&self, menus: Vec<Menu>, keymap: &Keymap) {
        unsafe {
            let app: id = msg_send![APP_CLASS, sharedApplication];
            let mut state = self.0.lock();
            let actions = &mut state.menu_actions;
            let menu = self.create_menu_bar(&menus, NSWindow::delegate(app), actions, keymap);
            drop(state);
            app.setMainMenu_(menu);
        }
        self.0.lock().menus = Some(menus.into_iter().map(|menu| menu.owned()).collect());

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Only call app_path from bundled builds; gate callers that assume a bundle
  2. Fall back to std::env::current_exe for unpackaged/dev runs
  3. Handle the Err at the call site to disable bundle-dependent features gracefully
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20). Data as JSON: /api/errors/763537de4b4d75a5. Report an issue: GitHub.