{"record":{"id":"267d6a2484d40a7f","repo":"gitbutlerapp/gitbutler","slug":"could-not-resolve-application-path-for-bundle-identifier","errorCode":null,"errorMessage":"Could not resolve application path for '{bundle_identifier}'","messagePattern":"Could not resolve application path for '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-api/src/open/program.rs","lineNumber":615,"sourceCode":"\n    #[cfg(target_os = \"macos\")]\n    fn find_app_directory(&self) -> anyhow::Result<PathBuf> {\n        use objc2_app_kit::NSWorkspace;\n        use objc2_foundation::NSString;\n\n        let workspace = NSWorkspace::sharedWorkspace();\n        let bundle_identifier = NSString::from_str(&self.bundle_identifier);\n        let app_url = workspace\n            .URLForApplicationWithBundleIdentifier(&bundle_identifier)\n            .ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"Could not find application for '{}'\",\n                    self.bundle_identifier\n                )\n            })?;\n\n        app_url.to_file_path().ok_or_else(|| {\n            anyhow::anyhow!(\n                \"Could not resolve application path for '{}'\",\n                self.bundle_identifier\n            )\n        })\n    }\n}\n\n#[cfg(target_os = \"macos\")]\nfn open_in_macos_application(\n    app: &MacosApplication,\n    cli_arg_supplier: &CliArgumentSupplier,\n    open_spec: OpenSpec,\n) -> anyhow::Result<()> {\n    match open_spec {\n        OpenSpec::FileAtLine(path, line_nr) => match app.resolve_cli_wrapper_abspath() {\n            Ok(cli_abspath) => {\n                let mut cmd = Command::new(cli_abspath);\n                cli_arg_supplier.open_at_line(&mut cmd, &path, line_nr);","sourceCodeStart":597,"sourceCodeEnd":633,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-api/src/open/program.rs#L597-L633","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// before calling: confirm the app bundle exists locally\nlet exists = std::path::Path::new(\"/Applications/YourApp.app\").exists();","typeGuard":null,"tryCatchPattern":"// match on the error and fall back to PATH lookup\nmatch resolve_cli_wrapper_abspath(id) {\n    Ok(path) => path,\n    Err(e) if e.to_string().contains(\"Could not resolve application path\") => fallback_to_path_lookup(),\n    Err(e) => return Err(e),\n}","preventionTips":["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"],"tags":["macos","filesystem","path-resolution"],"backgroundTag":"file-not-found","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}