gitbutlerapp/gitbutler · warning
Failed to get app bundle name
Error message
Failed to get app bundle name
What it means
Thrown in install_app in install_macos.rs when app_dir.file_name() returns None, i.e. the extracted .app bundle path terminates in '..' or is a root path. extract_tarball returns a directory entry found via read_dir, which always has a normal file name, so this is a defensive guard against impossible paths rather than a realistic runtime failure.
Source
Thrown at crates/but-installer/src/install_macos.rs:73
success("Download completed successfully");
verify_signature(&tarball_path, &platform_info.signature, temp_dir.path())?;
info("Extracting archive...");
let app_dir = extract_tarball(&tarball_path, temp_dir.path())?;
success("Archive extracted successfully");
verify_app_structure(&app_dir)?;
install_app(&app_dir, &config.home_dir, channel)?;
Ok(())
}
pub(crate) fn install_app(app_dir: &Path, home_dir: &Path, channel: Option<Channel>) -> Result<()> {
let app_basename = app_dir
.file_name()
.ok_or_else(|| anyhow!("Failed to get app bundle name"))?;
let install_app = home_dir.join("Applications").join(app_basename);
let install_app_backup = home_dir
.join("Applications")
.join(format!("{}.backup", app_basename.to_string_lossy()));
let install_app_new = home_dir
.join("Applications")
.join(format!("{}.new", app_basename.to_string_lossy()));
info(&format!(
"Installing{} to {}...",
channel
.map(|c| format!(" channel {}", c.display_name()))
.unwrap_or_default(),
install_app.display()
));
// Clean up any leftover temp files from previous failed installationsView on GitHub (pinned to caf1f223d3)
Solutions
- Call install_app with the directory returned by extract_tarball, not a hand-built path.
- If invoking directly, pass a concrete .app directory path (e.g. .../GitButler.app), never a root or '..'-terminated path.
Defensive patterns
Strategy: validation
Validate before calling
// Before install_app(app_dir, ...)
fn is_valid_app_dir(p: &std::path::Path) -> bool {
p.file_name().map(|n| n.to_string_lossy().ends_with(".app")).unwrap_or(false)
} Prevention
- Only call install_app with directories produced by extract_tarball.
- In tests/direct calls, pass a concrete '<Name>.app' path, never root or '..'.
When it happens
Trigger: app_dir being "/" or ending in ".." when install_app computes the destination bundle name under ~/Applications; only possible if a caller hand-constructs app_dir instead of using extract_tarball's output.
Common situations: Not observed in normal installs. Appears only in tests or custom code that calls install_app directly with a synthesized path; treat occurrences as a caller bug.
Related errors
- Failed to extract filename from download URL
- No .app bundle found in extracted archive
- Extracted app bundle does not contain expected directory str
- No download URL for platform {} in release {}
- Failed to move new installation into place - restoring backu
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/19b7e001a4f0aa47.
Report an issue: GitHub.