{"record":{"id":"7ca4f252efa1c740","repo":"jdx/mise","slug":"unexpected-bottle-layout-for-name-missing-name","errorCode":null,"errorMessage":"unexpected bottle layout for {name}: missing {name}/{pkg_version} in archive","messagePattern":"unexpected bottle layout for (.+?): missing (.+?)/(.+?) in archive","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/pour.rs","lineNumber":399,"sourceCode":"        staging,\n        keg_only: rf.formula.keg_only_for_target(),\n    };\n\n    // bottle tarballs contain <name>/<pkg_version>/...\n    pr.set_message(\"extract\".to_string());\n    crate::file::untar(\n        tarball,\n        prepared.staging.path(),\n        ExtractionFormat::TarGz,\n        &ExtractOptions {\n            strip_components: 0,\n            pr: Some(pr),\n            preserve_mtime: true,\n        },\n    )\n    .wrap_err_with(|| format!(\"failed to extract bottle for {name}\"))?;\n    if !prepared.staged_keg.exists() {\n        bail!(\n            \"unexpected bottle layout for {name}: missing {name}/{} in archive\",\n            prepared.pkg_version\n        );\n    }\n\n    // \":any_skip_relocation\" skips binary linkage relocation, but Homebrew\n    // still replaces placeholders in text files. On Linux, bottles built by\n    // Homebrew < 5.1.15 are incorrectly tagged and still need ELF linkage\n    // relocation (brew applies the same version check in\n    // extend/os/linux/bottle_specification.rb).\n    let skip_linkage = bottle.cellar == \":any_skip_relocation\"\n        && (cfg!(target_os = \"macos\")\n            || bottled_by_homebrew_at_least(&prepared.staged_keg, (5, 1, 15)));\n    pr.set_message(\"relocate\".to_string());\n    let report = relocate::relocate_keg(&prepared.staged_keg, name, skip_linkage)?;\n    // arm64 macOS kills binaries whose signature doesn't match; Linux ELF\n    // files have no signatures to fix\n    if cfg!(target_os = \"macos\") && !report.changed_machos.is_empty() {","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/brew/pour.rs#L381-L417","documentation":"When pouring a bottle, prepare_bottle extracts the archive and expects Homebrew's standard layout: a top-level `<name>/<pkg_version>/` directory containing the keg. If that directory is absent after extraction, the bottle's layout doesn't match what the API metadata promised, and mise bails rather than installing a keg at an unknown location.","triggerScenarios":"prepare_bottle extracts a downloaded bottle tarball and prepared.staged_keg does not exist — the archive lacks the `<name>/<pkg_version>` top-level directory (corrupt/truncated download, wrong bottle served, upstream layout change, or version mismatch between API metadata and artifact).","commonSituations":"Proxy or mirror serving stale/partial bottle tarballs; API bottle metadata out of sync with the uploaded artifact; cache holding a damaged download.","solutions":["Delete the cached bottle and retry so the archive is re-downloaded","Verify the bottle URL/tarball manually (`tar tf bottle.tar.gz | head`) to confirm it contains `<name>/<version>/`","Check for a mise or homebrew-core/tap update — a formula/pkg-version layout change may need a newer mise"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"tar -tzf bottle.tar.gz | grep -q \"^$name/$version/\" || echo \"bottle layout mismatch\"","typeGuard":null,"tryCatchPattern":"try {\n  applyBrewPackage(name);\n} catch (e) {\n  if (String(e).includes('unexpected bottle layout')) {\n    clearBottleCache();\n    applyBrewPackage(name); // retry with a fresh download\n  } else throw e;\n}","preventionTips":["Clear the bottle cache after network interruptions or proxy changes","Keep mise updated so bottle metadata handling matches current Homebrew artifacts","Verify bottles come from the official ghcr.io source, not a stale mirror"],"tags":["brew","archive","extraction"],"backgroundTag":"unexpected-archive-layout","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}