{"record":{"id":"2402484924575755","repo":"gitbutlerapp/gitbutler","slug":"extracted-app-bundle-does-not-contain-expected-dir","errorCode":null,"errorMessage":"Extracted app bundle does not contain expected directory structure (Contents/MacOS)","messagePattern":"Extracted app bundle does not contain expected directory structure \\(Contents/MacOS\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-installer/src/install_macos.rs","lineNumber":339,"sourceCode":"\n    // Find the extracted .app bundle\n    let mut app_dir = None;\n    for entry in fs::read_dir(dest_dir)? {\n        let entry = entry?;\n        let path = entry.path();\n        if path.is_dir() && path.extension().and_then(|s| s.to_str()) == Some(\"app\") {\n            app_dir = Some(path);\n            break;\n        }\n    }\n\n    app_dir.ok_or_else(|| anyhow!(\"No .app bundle found in extracted archive\"))\n}\n\npub(crate) fn verify_app_structure(app_dir: &Path) -> Result<()> {\n    let binaries_dir = app_dir.join(\"Contents/MacOS\");\n    if !binaries_dir.is_dir() {\n        bail!(\n            \"Extracted app bundle does not contain expected directory structure (Contents/MacOS)\"\n        );\n    }\n\n    let required_binaries = [\"gitbutler-git-askpass\", \"gitbutler-tauri\"];\n\n    for binary in &required_binaries {\n        let binary_path = binaries_dir.join(binary);\n        if !binary_path.exists() {\n            bail!(\"Missing required binary: {binary}\");\n        }\n    }\n\n    Ok(())\n}\n\nfn validate_tarball(path: &Path) -> Result<()> {\n    // Check if file is not empty","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-installer/src/install_macos.rs#L321-L357","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn app_bundle_looks_valid(app_dir: &std::path::Path) -> bool {\n    app_dir.join(\"Contents/MacOS\").is_dir()\n}","typeGuard":"fn is_app_dir(p: &std::path::Path) -> bool {\n    p.is_dir() && p.extension().map(|e| e == \"app\").unwrap_or(false)\n}","tryCatchPattern":"if let Err(e) = download_and_install_app(...).await {\n    if e.to_string().contains(\"Contents/MacOS\") {\n        // discard extracted dir and re-download the archive\n    }\n}","preventionTips":["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"],"tags":["macos","app-bundle","archive","validation"],"backgroundTag":"file-not-found","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"}