{"record":{"id":"a475b6d0ed7210bb","repo":"bazelbuild/bazel","slug":"unknown-archive-type-s","errorCode":null,"errorMessage":"unknown archive type \"%s\"","messagePattern":"unknown archive type \"(.+?)\"","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"combine_distfiles.py","lineNumber":46,"sourceCode":"def main():\n  output_zip = os.path.join(os.getcwd(), sys.argv[1])\n  input_files = sorted(sys.argv[2:])\n\n  # Copy all the input_files into output_zip.\n  # Adding contextlib.closing to be python 2.6 (for centos 6.7) compatible\n  with contextlib.closing(\n      zipfile.ZipFile(output_zip, \"w\", zipfile.ZIP_DEFLATED)) as output_zip:\n\n    def _normalize(path):\n      return path[2:] if path.startswith(\"./\") else path\n\n    for input_file in input_files:\n      if input_file.endswith(\".tar\"):\n        copy_tar_to_zip(output_zip, input_file, _normalize)\n      elif input_file.endswith(\".zip\"):\n        copy_zip_to_zip(output_zip, input_file, _normalize)\n      else:\n        raise Exception(\"unknown archive type \\\"%s\\\"\" % input_file)\n\n\nif __name__ == \"__main__\":\n  main()\n","sourceCodeStart":28,"sourceCodeEnd":51,"githubUrl":"https://github.com/bazelbuild/bazel/blob/e6e199d0601a244511b4cf18c8b2828aa73db1fd/combine_distfiles.py#L28-L51","documentation":"Raised by Bazel's combine_distfiles.py packaging helper, which merges distribution archives into a single zip. It only knows how to copy entries from '.tar' inputs (copy_tar_to_zip) and '.zip' inputs (copy_zip_to_zip); any other file extension aborts with 'unknown archive type'.","triggerScenarios":"Running the combine_distfiles tool with an input_files list containing a file whose name does not end in '.tar' or '.zip' (e.g. '.tar.gz', '.tgz', '.jar' or a raw file).","commonSituations":"A dependency's distfile was re-compressed as .tar.gz or renamed; a new input added to the genrule invoking this script uses an unsupported format; case-sensitive extension mismatch ('.ZIP').","solutions":["Repackage the offending input as a plain .tar or .zip (gunzip the .tar.gz, rezip the .jar contents) and update the input list.","Check the exact filename printed in the message for extension typos or uppercase variants.","If a new format is genuinely required, extend the script with a handler branch instead of bypassing the check."],"exampleFix":"# before\ninput_files = [\"bazel-dist.tar.gz\", \"extra.zip\"]\n\n# after\ninput_files = [\"bazel-dist.tar\", \"extra.zip\"]  # decompress to plain .tar first","handlingStrategy":"validation","validationCode":"import os\n\nvalid_exts = ('.tar', '.zip')\nbad = [f for f in input_files if not f.endswith(valid_exts)]\nif bad:\n    raise ValueError('unsupported inputs (need .tar/.zip): %s' % bad)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize all distfiles on plain .tar or .zip before invoking the combiner.","Add a CI check that fails on new files with extensions other than .tar/.zip in the distfiles list."],"tags":["build","packaging","distfiles","python"],"backgroundTag":null,"analyzedSha":"e6e199d0601a244511b4cf18c8b2828aa73db1fd","analyzedAt":"2026-08-14T10:24:27.848Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}