{"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":227,"sourceCode":"    }\n    crate::file::create_dir_all(&scratch)?;\n\n    // bottle tarballs contain <name>/<pkg_version>/...\n    pr.set_message(\"extract\".to_string());\n    crate::file::untar(\n        tarball,\n        &scratch,\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    let inner = scratch.join(name).join(&pkg_version);\n    if !inner.exists() {\n        bail!(\"unexpected bottle layout for {name}: missing {name}/{pkg_version} in archive\");\n    }\n    crate::file::rename(&inner, &tmp)?;\n    crate::file::remove_all(&scratch)?;\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\") || bottled_by_homebrew_at_least(&tmp, (5, 1, 15)));\n    pr.set_message(\"relocate\".to_string());\n    let report = relocate::relocate_keg(&tmp, 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() {\n        pr.set_message(\"codesign\".to_string());\n        relocate::codesign(&report.changed_machos)","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/pour.rs#L209-L245","documentation":"After extracting a downloaded Homebrew bottle tarball, pour expects the standard layout <name>/<pkg_version>/ inside the archive and moves that directory into the keg. If the expected directory is absent, the bottle's layout is unrecognized, so it aborts rather than installing a mangled package.","triggerScenarios":"The downloaded bottle tarball does not contain a top-level `<name>/<pkg_version>/` directory — e.g. a corrupt/truncated download, a bottle built with an unexpected layout, or a mismatch between the requested version and the bottle contents.","commonSituations":"Proxy or CDN serving an HTML error page saved as a tarball; manually crafted or third-party bottles; Homebrew changing tab/layout details; interrupted download left a partial cache entry.","solutions":["Delete the cached/downloaded bottle and re-run so it downloads fresh","Verify the bottle tarball layout with `tar tf <bottle>.tar.gz` — expect `<name>/<version>/`","Check disk space and network integrity; retry the install","Report the formula if upstream publishes a non-standard bottle layout"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# verify bottle layout before/after download\n tar tzf bottle.tar.gz | grep -q '^<name>/<version>/' || echo 'unexpected bottle layout'","typeGuard":null,"tryCatchPattern":"catch (e) {\n  if (String(e).includes('unexpected bottle layout')) {\n    purgeBottleCache();\n    return retryInstall();\n  }\n  throw e;\n}","preventionTips":["Clear bottle download cache after failed installs","Verify archive integrity (checksums) before extraction","Avoid proxies that may replace binary downloads"],"tags":["brew","extract","unexpected-layout","package-install"],"backgroundTag":"unexpected-response-shape","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}