dotnet/efcore · error · FileNotFoundError
Could not find 'data.tar.*' in
Error message
Could not find 'data.tar.*' in {deb_file}. What it means
Raised by extract_deb_file (a FileNotFoundError) when 'ar t' lists the archive members and none of them starts with 'data.tar'. It means the file on disk is not a valid .deb, or its data payload is absent or named differently.
Solutions
- Inspect the file: run `file <deb_file>` and `head -c 200 <deb_file>` to see whether it is HTML instead of an ar archive.
- Run `ar t <deb_file>` manually to see the actual member list.
- Verify --mirror/--suite/--arch produce the right download URLs.
- Re-run in case it was a transient mirror/CDN issue serving the wrong body.
Example fix
// before
result = subprocess.run([ar_tool, "t", os.path.abspath(deb_file)], cwd=tmp_subdir, check=True, ...)
// after
with open(deb_file, "rb") as fh:
if fh.read(8) != b"!<arch>\n":
raise FileNotFoundError(f"{deb_file} is not a valid .deb (bad magic bytes)")
result = subprocess.run([ar_tool, "t", os.path.abspath(deb_file)], cwd=tmp_subdir, check=True, ...) Defensive patterns
Strategy: validation
Validate before calling
# preflight: verify each downloaded file is a real .deb (ar magic) before extracting
import os
def is_deb(p):
with open(p, "rb") as fh:
return fh.read(8) == b"!<arch>\n"
bad = [f for f in os.listdir(tmp_dir) if f.endswith(".deb") and not is_deb(os.path.join(tmp_dir, f))]
if bad:
sys.exit(f"downloaded files are not valid .deb (likely HTML error pages): {bad}") Prevention
- After download, sanity-check each .deb's magic bytes (b"!<arch>\n") and reject HTML bodies.
- Verify the mirror/suite/arch produce correct URLs so error pages are not served.
- Watch for transparent proxies that inject HTML block pages with status 200.
When it happens
Trigger: The file at {tmp_dir}/{basename(filename)} is passed to ar t, and no output line begins with 'data.tar'. Typically because the file is not a .deb at all.
Common situations: The mirror served an HTML error page (custom 404 page returned with status 200), a partial/truncated download, a proxy injecting an HTML block page, a wrong suite so a different file was downloaded, or a corrupted deb.
Related errors
- Failed to download , Status Code
- SHA256 mismatch for : expected , got
- Unsupported compression format
- Could not find checksum for
- Failed to download after attempts.
AI-assisted analysis of dotnet/efcore@3a2006ef56 (2026-08-11).
Data as JSON: /api/errors/c1bd751120a71d67.
Report an issue: GitHub.
Appendix: source
Thrown at eng/common/cross/install-debs.py:308
print("All done!")
def extract_deb_file(deb_file, tmp_dir, extract_dir, ar_tool):
"""Extract .deb file contents"""
os.makedirs(extract_dir, exist_ok=True)
with tempfile.TemporaryDirectory(dir=tmp_dir) as tmp_subdir:
result = subprocess.run([ar_tool, "t", os.path.abspath(deb_file)], cwd=tmp_subdir, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
tar_filename = None
for line in result.stdout.decode().splitlines():
if line.startswith("data.tar"):
tar_filename = line.strip()
break
if not tar_filename:
raise FileNotFoundError(f"Could not find 'data.tar.*' in {deb_file}.")
tar_file_path = os.path.join(tmp_subdir, tar_filename)
print(f"Extracting {tar_filename} from {deb_file}..")
with open(tar_file_path, "wb") as outfile:
subprocess.run([ar_tool, "p", os.path.abspath(deb_file), tar_filename], check=True, stdout=outfile, stderr=subprocess.PIPE)
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()View on GitHub (pinned to 3a2006ef56)