gitbutlerapp/gitbutler · error

Failed to extract filename from download URL

Error message

Failed to extract filename from download URL

What it means

After obtaining the download URL, the macOS installer derives the tarball filename by splitting the URL on '/' and taking the last segment. Because split('/').next_back() on a non-empty string is technically an Option, the code maps None to "Failed to extract filename from download URL". In practice this only fires for empty or path-less URLs.

Solutions

  1. Verify the release's asset URL is a full path ending in a filename (e.g. .../GitButler.app.tar.gz)
  2. Fix the release asset on GitHub and retry the installation
  3. Use a version of the installer whose platform metadata points at correct asset URLs
Defensive patterns

Strategy: validation

Validate before calling

let filename_ok = download_url.rsplit('/').next().map_or(false, |f| !f.is_empty());
if !filename_ok {
    return Err(format!("download URL has no filename: {download_url}"));
}

Prevention

When it happens

Trigger: download_and_install_app called with a platform_info.url that is empty or lacks any '/'-separated segment after the host, so no filename can be derived.

Common situations: A release asset URL configured as an empty string or a bare origin URL (e.g. "https://example.com"), typically from broken release metadata.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


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

Appendix: source

Thrown at crates/but-installer/src/install_macos.rs:48

    let download_url = platform_info.url.as_deref().ok_or_else(|| {
        anyhow::anyhow!(
            "No download URL for platform {} in release {}",
            config.platform,
            release.version
        )
    })?;

    validate_download_url(download_url)?;
    info(&format!("Download URL: {download_url}"));

    let temp_dir = tempfile::Builder::new()
        .prefix("gitbutler-install.")
        .tempdir()?;

    let filename = download_url
        .split('/')
        .next_back()
        .ok_or_else(|| anyhow::anyhow!("Failed to extract filename from download URL"))?;
    let tarball_path = temp_dir.path().join(filename);

    info(&format!("Downloading GitButler {}...", release.version));
    download_file(download_url, &tarball_path)?;

    validate_tarball(&tarball_path)?;
    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)?;

View on GitHub (pinned to 58e5313667)