gitbutlerapp/gitbutler · error
Could not resolve application path for
Error message
Could not resolve application path for '{bundle_identifier}' What it means
This error is thrown by the macOS application-lookup helper `find_app_directory` when a bundle URL obtained from the system (e.g. via Spotlight/LaunchServices for a bundle identifier) cannot be converted into a filesystem path via `Url::to_file_path()`. It means the OS reported an application for the bundle identifier but its URL is not a valid `file://` path the library can use to launch it.
Solutions
- Re-register the application with LaunchServices (e.g. `lsregister -f /Applications/App.app`)
- Reinstall the application the bundle identifier points to
- Verify the app exists locally at /Applications and is not a cloud/placeholder item
- Check for an alternative lookup path (PATH-based binary resolution) instead of bundle lookup
Defensive patterns
Strategy: fallback
Validate before calling
// before calling: confirm the app bundle exists locally
let exists = std::path::Path::new("/Applications/YourApp.app").exists(); Try / catch
// match on the error and fall back to PATH lookup
match resolve_cli_wrapper_abspath(id) {
Ok(path) => path,
Err(e) if e.to_string().contains("Could not resolve application path") => fallback_to_path_lookup(),
Err(e) => return Err(e),
} Prevention
- Verify the app is installed locally, not a cloud placeholder
- Re-register apps with LaunchServices after moving them
- Prefer PATH-based binary resolution when available
When it happens
Trigger: Calling `resolve_cli_wrapper_abspath` (which calls `find_app_directory`) on macOS when the system returns an app URL that is not a local file path — e.g. a remote or non-file URL, or a URL with a host component.
Common situations: Corrupt or unusual app registration in LaunchServices; the 'app' is actually a network volume or cloud placeholder; running in a sandboxed/containerized environment where app bundles resolve oddly; stale Spotlight metadata.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Failed to create symlink
- Failed to get app bundle name
- Failed to move new installation into place - restoring…
- A 'but' binary already exists at
- BUG: we do not create or work with symlinks
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/267d6a2484d40a7f.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-api/src/open/program.rs:615
#[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,
open_spec: OpenSpec,
) -> anyhow::Result<()> {
match open_spec {
OpenSpec::FileAtLine(path, line_nr) => match app.resolve_cli_wrapper_abspath() {
Ok(cli_abspath) => {
let mut cmd = Command::new(cli_abspath);
cli_arg_supplier.open_at_line(&mut cmd, &path, line_nr);View on GitHub (pinned to 58e5313667)