gitbutlerapp/gitbutler · error
Extracted app bundle does not contain expected directory…
Error message
Extracted app bundle does not contain expected directory structure (Contents/MacOS)
What it means
After extracting the downloaded archive, verify_app_structure checks that the located .app bundle contains a Contents/MacOS directory. A macOS app bundle without this directory is not a runnable application, so the installer refuses to continue with this error.
Solutions
- Verify you downloaded the correct macOS .app release artifact and that the download completed (compare checksum/size)
- Delete the partially extracted bundle and re-run the installer to re-download and re-extract
- Inspect the extracted bundle with `find App.app -maxdepth 3` — if Contents/MacOS is missing, the artifact or archive is bad; report/check the release pipeline
- Ensure extraction preserves the full directory tree (avoid tools that flatten or skip directories)
Defensive patterns
Strategy: validation
Validate before calling
fn app_bundle_looks_valid(app_dir: &std::path::Path) -> bool {
app_dir.join("Contents/MacOS").is_dir()
} Type guard
fn is_app_dir(p: &std::path::Path) -> bool {
p.is_dir() && p.extension().map(|e| e == "app").unwrap_or(false)
} Try / catch
if let Err(e) = download_and_install_app(...).await {
if e.to_string().contains("Contents/MacOS") {
// discard extracted dir and re-download the archive
}
} Prevention
- Verify archive checksum before extraction
- Use extraction tools that preserve the full directory tree
- Confirm the artifact is the macOS bundle for the right architecture
- Re-extract into a clean directory to avoid stale partial contents
When it happens
Trigger: download_and_install_app extracts the release archive, find_app_dir locates some .app directory, but app_dir.join("Contents/MacOS") is not a directory — the bundle layout is wrong — so verify_app_structure bails.
Common situations: Release asset changed its internal layout (build/CI change), corrupted or truncated archive where only part of the bundle extracted, wrong artifact downloaded (not the macOS bundle), extraction tool skipping directories or symlinks, case-sensitivity issues on the filesystem.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Missing required binary
- Downloaded file does not appear to be a valid gzip archive
- A 'but' binary already exists at
- Aborting due to empty branch name
- Aborting due to empty
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/2402484924575755.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-installer/src/install_macos.rs:339
// Find the extracted .app bundle
let mut app_dir = None;
for entry in fs::read_dir(dest_dir)? {
let entry = entry?;
let path = entry.path();
if path.is_dir() && path.extension().and_then(|s| s.to_str()) == Some("app") {
app_dir = Some(path);
break;
}
}
app_dir.ok_or_else(|| anyhow!("No .app bundle found in extracted archive"))
}
pub(crate) fn verify_app_structure(app_dir: &Path) -> Result<()> {
let binaries_dir = app_dir.join("Contents/MacOS");
if !binaries_dir.is_dir() {
bail!(
"Extracted app bundle does not contain expected directory structure (Contents/MacOS)"
);
}
let required_binaries = ["gitbutler-git-askpass", "gitbutler-tauri"];
for binary in &required_binaries {
let binary_path = binaries_dir.join(binary);
if !binary_path.exists() {
bail!("Missing required binary: {binary}");
}
}
Ok(())
}
fn validate_tarball(path: &Path) -> Result<()> {
// Check if file is not emptyView on GitHub (pinned to 58e5313667)