gitbutlerapp/gitbutler · error

Could not find application for

Error message

Could not find application for '{bundle_identifier}'

What it means

MacosApplication::find_app_directory uses NSWorkspace.URLForApplicationWithBundleIdentifier to resolve an installed app's location from its bundle identifier. When LaunchServices has no application registered under that identifier, the URL is nil and the code raises 'Could not find application for {bundle_identifier}'. It means the application the registry expects is simply not installed (or not visible to LaunchServices) on this Mac.

Solutions

  1. Install the application identified by that bundle identifier, or switch the configured terminal/app in Settings to one that is installed.
  2. If installed elsewhere, re-register it with LaunchServices: `/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /path/to/App.app`.
  3. Confirm the bundle id resolves: `mdfind 'kMDItemCFBundleIdentifier == "<bundle_identifier>"'`.
  4. Launch the app once manually so macOS registers it, then retry.

Example fix

// before
# app uninstalled, settings still point to it
mdfind 'kMDItemCFBundleIdentifier == "com.apple.Terminal"' // no result
// after
# reinstall or pick an installed app; verify:
mdfind 'kMDItemCFBundleIdentifier == "com.apple.Terminal"' // /System/Applications/Utilities/Terminal.app
Defensive patterns

Strategy: validation

Validate before calling

# verify the bundle id resolves before invoking
mdfind "kMDItemCFBundleIdentifier == 'com.wez.wezterm'" | grep -q . && echo installed || echo 'app not installed'

Try / catch

try {
  await openInMacosApplication(bundleId, path);
} catch (e) {
  if (String(e).startsWith('Could not find application for')) {
    showToast(`${bundleId} is not installed. Install it or pick another terminal in Settings.`);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling open_in_macos_application (via resolve_cli_wrapper_abspath) with a bundle_identifier that no installed application registers — the app was never installed, was uninstalled, or is only present in a non-standard location LaunchServices doesn't know.

Common situations: User selected a terminal/app that isn't installed; app moved out of /Applications and LaunchServices lost it; app installed for another user or via unregistered portable copy; stale Settings entry after uninstalling the app.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/0d3a60ec02c6daac. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-api/src/open/program.rs:608

    fn resolve_cli_wrapper_abspath(&self) -> anyhow::Result<PathBuf> {
        let app_dir_path = self.find_app_directory()?;
        let cli_wrapper_path = self.cli_wrapper_path.as_deref().ok_or_else(|| {
            anyhow::anyhow!("No CLI wrapper configured for {}", self.bundle_identifier)
        })?;
        Ok(app_dir_path.join(cli_wrapper_path))
    }

    #[cfg(target_os = "macos")]
    fn find_app_directory(&self) -> anyhow::Result<PathBuf> {
        use objc2_app_kit::NSWorkspace;
        use objc2_foundation::NSString;

        let workspace = NSWorkspace::sharedWorkspace();
        let bundle_identifier = NSString::from_str(&self.bundle_identifier);
        let app_url = workspace
            .URLForApplicationWithBundleIdentifier(&bundle_identifier)
            .ok_or_else(|| {
                anyhow::anyhow!(
                    "Could not find application for '{}'",
                    self.bundle_identifier
                )
            })?;

        app_url.to_file_path().ok_or_else(|| {
            anyhow::anyhow!(
                "Could not resolve application path for '{}'",
                self.bundle_identifier
            )
        })
    }
}

#[cfg(target_os = "macos")]
fn open_in_macos_application(
    app: &MacosApplication,
    cli_arg_supplier: &CliArgumentSupplier,

View on GitHub (pinned to 58e5313667)