dotnet/maui · error · ValueError
Unsupported compression format: {file_extension}
Error message
Unsupported compression format: {file_extension} What it means
extract_debs raises ValueError when the data.tar member's extension is not one of .xz, .gz, or .zst. The script only knows how to open those compression modes; any other extension (e.g. .bz2, .lzma, or no extension) is rejected after the archive is already extracted from the .deb.
Source
Thrown at eng/common/cross/install-debs.py:268
subprocess.run(f"{ar_tool} p {os.path.abspath(deb_file)} {tar_filename} > {tar_file_path}", check=True, shell=True)
file_extension = os.path.splitext(tar_file_path)[1].lower()
if file_extension == ".xz":
mode = "r:xz"
elif file_extension == ".gz":
mode = "r:gz"
elif file_extension == ".zst":
# zstd is not supported by standard library yet
decompressed_tar_path = tar_file_path.replace(".zst", "")
with open(tar_file_path, "rb") as zst_file, open(decompressed_tar_path, "wb") as decompressed_file:
dctx = zstandard.ZstdDecompressor()
dctx.copy_stream(zst_file, decompressed_file)
tar_file_path = decompressed_tar_path
mode = "r"
else:
raise ValueError(f"Unsupported compression format: {file_extension}")
with tarfile.open(tar_file_path, mode) as tar:
tar.extractall(path=extract_dir, filter='fully_trusted')
def finalize_setup(rootfsdir):
lib_dir = os.path.join(rootfsdir, 'lib')
usr_lib_dir = os.path.join(rootfsdir, 'usr', 'lib')
if os.path.exists(lib_dir):
if os.path.islink(lib_dir):
os.remove(lib_dir)
else:
os.makedirs(usr_lib_dir, exist_ok=True)
for item in os.listdir(lib_dir):
src = os.path.join(lib_dir, item)
dest = os.path.join(usr_lib_dir, item)
View on GitHub (pinned to f377ff1c5e)
Solutions
- Prefer a suite/mirror whose debs use xz or zst (current Debian/Ubuntu default).
- If .bz2 support is required, extend the branch to add `mode = 'r:bz2'` for the .bz2 case.
- Verify the member name with `ar t file.deb`; if it is data.tar (uncompressed), add an `else: mode = 'r'` branch.
- Avoid hand-modified debs with non-standard compression.
Example fix
# before
elif file_extension == ".zst":
...
else:
raise ValueError(f"Unsupported compression format: {file_extension}")
# after
elif file_extension == ".bz2":
mode = "r:bz2"
elif file_extension == ".zst":
...
else:
raise ValueError(f"Unsupported compression format: {file_extension}") Defensive patterns
Strategy: validation
Validate before calling
ext = os.path.splitext(tar_file_path)[1].lower()
if ext not in ('.xz', '.gz', '.zst'):
raise ValueError(f"Unsupported compression format: {ext}") Type guard
def is_supported_compression(ext): return ext.lower() in ('.xz', '.gz', '.zst') Try / catch
try:
extract_debs([deb], ...)
except ValueError as e:
print(e); re_fetch_from_xz_mirror(deb) Prevention
- Prefer suites whose debs use xz or zst.
- Extend the compression branch if you must support bz2/lzma.
- Inspect member names with `ar t` before extraction.
When it happens
Trigger: A .deb whose data member is data.tar.bz2 or another unsupported compression, or a tar_file_path whose extension parsing yields an unexpected value (e.g. data.tar with no compression suffix).
Common situations: Older Debian archives using bzip2, experimental lzma-compressed debs, or a renamed/mangled member name that confuses splitext.
Related errors
- Invalid Debian version format: {version}
- Could not find 'data.tar.*' in {deb_file}.
- Unsupported distro
AI-assisted analysis of dotnet/maui@f377ff1c5e (2026-08-13).
Data as JSON: /api/errors/1ff4f0339af6848a.
Report an issue: GitHub.