gitbutlerapp/gitbutler · error

Failed to get app bundle name

Error message

Failed to get app bundle name

What it means

install_app on macOS needs the .app bundle's file name to build the destination path under ~/Applications and its backup paths. If the Path app_dir has no final component, file_name() returns None and the error "Failed to get app bundle name" is thrown. This indicates the extracted .app directory path is malformed.

Solutions

  1. Re-download the release; the archive is likely corrupted or oddly packaged
  2. Check the tarball contents (tar -tzf) to see the actual .app path shape
  3. Verify disk space and integrity during extraction, then retry
Defensive patterns

Strategy: try-catch

Validate before calling

if app_dir.file_name().is_none() {
    return Err(format!("degenerate app_dir path: {}", app_dir.display()));
}

Try / catch

// treat this as a corrupted-archive signal and re-download
match install_app(&app_dir, &home_dir, channel) {
    Err(e) if e.to_string().contains("Failed to get app bundle name") => eprintln!("archive malformed; re-download"),
    other => other?,
}

Prevention

When it happens

Trigger: download_and_install_app passes an app_dir returned by the archive scan whose Path terminates in ".." or is a root path, so file_name() yields None.

Common situations: A malformed tarball whose .app entry resolves to a degenerate path (e.g. entries like ".app" or paths built with trailing separators collapsing to ".."), or tampered/corrupted archives.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: 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 installations

View on GitHub (pinned to 58e5313667)