{"record":{"id":"5705682990013f27","repo":"gitbutlerapp/gitbutler","slug":"failed-to-extract-filename-from-download-url","errorCode":null,"errorMessage":"Failed to extract filename from download URL","messagePattern":"Failed to extract filename from download URL","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-installer/src/install_macos.rs","lineNumber":48,"sourceCode":"    let download_url = platform_info.url.as_deref().ok_or_else(|| {\n        anyhow::anyhow!(\n            \"No download URL for platform {} in release {}\",\n            config.platform,\n            release.version\n        )\n    })?;\n\n    validate_download_url(download_url)?;\n    info(&format!(\"Download URL: {download_url}\"));\n\n    let temp_dir = tempfile::Builder::new()\n        .prefix(\"gitbutler-install.\")\n        .tempdir()?;\n\n    let filename = download_url\n        .split('/')\n        .next_back()\n        .ok_or_else(|| anyhow::anyhow!(\"Failed to extract filename from download URL\"))?;\n    let tarball_path = temp_dir.path().join(filename);\n\n    info(&format!(\"Downloading GitButler {}...\", release.version));\n    download_file(download_url, &tarball_path)?;\n\n    validate_tarball(&tarball_path)?;\n    success(\"Download completed successfully\");\n\n    verify_signature(&tarball_path, &platform_info.signature, temp_dir.path())?;\n\n    info(\"Extracting archive...\");\n    let app_dir = extract_tarball(&tarball_path, temp_dir.path())?;\n    success(\"Archive extracted successfully\");\n\n    verify_app_structure(&app_dir)?;\n\n    install_app(&app_dir, &config.home_dir, channel)?;\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-installer/src/install_macos.rs#L30-L66","documentation":"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.","triggerScenarios":"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.","commonSituations":"A release asset URL configured as an empty string or a bare origin URL (e.g. \"https://example.com\"), typically from broken release metadata.","solutions":["Verify the release's asset URL is a full path ending in a filename (e.g. .../GitButler.app.tar.gz)","Fix the release asset on GitHub and retry the installation","Use a version of the installer whose platform metadata points at correct asset URLs"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let filename_ok = download_url.rsplit('/').next().map_or(false, |f| !f.is_empty());\nif !filename_ok {\n    return Err(format!(\"download URL has no filename: {download_url}\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure release asset URLs always end with a concrete filename","Validate platform_info.url shape when loading release metadata","Reject bare-origin URLs at metadata validation time"],"tags":["installer","url-parsing","macos"],"backgroundTag":"invalid-url-format","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"}