{"record":{"id":"140a65b86d60e78c","repo":"nodejs/node","slug":"error-don-t-know-how-to-unpack-s-with-extension","errorCode":null,"errorMessage":"Error: Don't know how to unpack %s with extension %s","messagePattern":"Error: Don't know how to unpack (.+?) with extension (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"tools/configure.d/nodedownload.py","lineNumber":80,"sourceCode":"        digest.update(chunk)\n        chunk = f.read(1024)\n    return digest.hexdigest()\n\ndef unpack(packedfile, parent_path):\n    \"\"\"Unpacks packedfile into parent_path. Assumes .zip. Returns parent_path\"\"\"\n    if zipfile.is_zipfile(packedfile):\n        with contextlib.closing(zipfile.ZipFile(packedfile, 'r')) as icuzip:\n            print(' Extracting zipfile: %s' % packedfile)\n            icuzip.extractall(parent_path)\n            return parent_path\n    elif tarfile.is_tarfile(packedfile):\n        with contextlib.closing(tarfile.TarFile.open(packedfile, 'r')) as icuzip:\n            print(' Extracting tarfile: %s' % packedfile)\n            icuzip.extractall(parent_path)\n            return parent_path\n    else:\n        packedsuffix = packedfile.lower().split('.')[-1]  # .zip, .tgz etc\n        raise Exception('Error: Don\\'t know how to unpack %s with extension %s' % (packedfile, packedsuffix))\n\n# List of possible \"--download=\" types.\ndownload_types = set(['icu'])\n\n# Default options for --download.\ndownload_default = \"none\"\n\ndef help():\n  \"\"\"This function calculates the '--help' text for '--download'.\"\"\"\n  return \"\"\"Select which packages may be auto-downloaded.\nvalid values are: none, all, %s. (default is \"%s\").\"\"\" % (\", \".join(download_types), download_default)\n\ndef set2dict(keys, value=None):\n  \"\"\"Convert some keys (iterable) to a dict.\"\"\"\n  return dict((key, value) for (key) in keys)\n\ndef parse(opt):\n  \"\"\"This function parses the options to --download and returns a set such as { icu: true }, etc. \"\"\"","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/configure.d/nodedownload.py#L62-L98","documentation":"Raised by unpacking logic in Node's tools/configure.d/nodedownload.py when the downloaded file is neither a valid zip (zipfile.is_zipfile false) nor a valid tar (tarfile.is_tarfile false). The script can only extract these two archive formats for auto-downloaded artifacts like ICU.","triggerScenarios":"configure's --download path fetches a file (e.g. ICU source) and passes it to the unpack routine, but the file is corrupt, truncated, or in an unsupported format (not .zip/.tgz/.tar.gz), so both format probes fail.","commonSituations":"A partially downloaded/corrupt archive (network drop, proxy truncation); a checksum-mismatched re-served HTML error page saved with a .tgz extension; an upstream artifact format change to an unsupported type.","solutions":["Delete the cached download and re-run configure --download to fetch a fresh, complete archive.","Verify the file with `file <downloaded>` and inspect its first bytes — an HTML page indicates a proxy/mirror error.","If the format genuinely changed, add the new format's extraction branch to nodedownload.py (matching zip/tar pattern) or convert the artifact to a supported format upstream."],"exampleFix":"# before\n./configure --download=icu   # corrupt cached file\n# after\nrm -rf ~/.cache/.../icu-src.tgz   # or the configured download cache\n./configure --download=icu","handlingStrategy":"validation","validationCode":"import zipfile, tarfile\ndef is_supported_archive(path: str) -> bool:\n    return zipfile.is_zipfile(path) or tarfile.is_tarfile(path)","typeGuard":"null","tryCatchPattern":"try:\n    unpack(downloaded)\nexcept Exception as e:\n    if \"Don't know how to unpack\" in str(e):\n        print('Archive corrupt or unsupported; delete cache and re-download.')\n    raise","preventionTips":["Delete the cached download and re-fetch on corruption.","Verify integrity with `file <archive>` before unpacking.","Keep configure's known formats (zip/tar) upstream; convert other formats."],"tags":["node","configure","download","archive","icu"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}