dotnet/aspnetcore · error · Exception
Failed to download , Status Code
Error message
Failed to download {url}, Status Code: {response.status} What it means
Raised by download_file when aiohttp returns a non-200 HTTP status for the requested URL. It captures the upstream status code so the operator can tell a 404 (wrong path) from a 403 (forbidden) or 5xx (server fault). Because it is raised inside the try, transient network errors are retried, but HTTP-level non-200 responses are not (they raise straight to the caller).
Solutions
- Open the printed URL in a browser or curl -I to confirm the status code and adjust --mirror/--suite/--arch accordingly.
- If 404, regenerate by pointing to a suite that still hosts the file (older stable point releases get archived under http://archive.debian.org).
- If 403/451, switch mirrors or networks to bypass filtering.
- If 5xx, retry shortly or fall back to a different mirror; do not change the script — the mirror is the fault.
Example fix
# before python3 install-debs.py --mirror http://ftp.debian.org/debian --suite buster --arch amd64 --rootfsdir rootfs libc6 # HTTP 404: buster moved to archive # after python3 install-debs.py --mirror http://archive.debian.org/debian --suite buster --arch amd64 --rootfsdir rootfs libc6
Defensive patterns
Strategy: validation
Validate before calling
# Validate the URL exists before the run for any package you care about:
for pkg in libc6 libc-bin; do
url="$MIRROR/$(curl -fsS "$MIRROR/dists/$SUITE/main/binary-$ARCH/Packages.gz" | gzip -d | awk -v p=$pkg '$1=="Package:"{n=$2} $1=="Filename:"&&n==p{print $2}')"
curl -fsS --head "$url" | head -1
done Prevention
- Confirm the --suite is still on the primary mirror; archived releases move to archive.debian.org.
- Match --arch to a path the mirror actually hosts.
- If behind a filtering proxy, request allow-listing for the mirror host.
When it happens
Trigger: session.get(url) returns a response whose .status is not 200 (404 for a package the index doesn't actually carry at that path, 403 from a firewall, 502/503 from an overloaded mirror).
Common situations: Stale Packages index referencing a .deb that was rotated off the mirror; wrong --arch (e.g. arm64 index pointing at a path only present for amd64); suite name typo; mirror with selective component availability (no 'universe'); geoblocking returning 403.
Related errors
- Failed to download after attempts.
- SHA256 mismatch for : expected , got
- SHA256 mismatch for : expected , got
- Could not find checksum for
- Could not find 'data.tar.*' in
AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11).
Data as JSON: /api/errors/1b4aa6077aa208c5.
Report an issue: GitHub.
Appendix: source
Thrown at eng/common/cross/install-debs.py:40
attempt = 0
while attempt < max_retries:
try:
async with session.get(url, timeout=aiohttp.ClientTimeout(total=timeout)) as response:
if response.status == 200:
with open(dest_path, "wb") as f:
content = await response.read()
# verify checksum if provided
if checksum:
sha256 = hashlib.sha256(content).hexdigest()
if sha256 != checksum:
raise Exception(f"SHA256 mismatch for {url}: expected {checksum}, got {sha256}")
f.write(content)
print(f"Downloaded {url} at {dest_path}")
return
else:
raise Exception(f"Failed to download {url}, Status Code: {response.status}")
except (asyncio.CancelledError, asyncio.TimeoutError, aiohttp.ClientError) as e:
print(f"Error downloading {url}: {type(e).__name__} - {e}. Retrying...")
attempt += 1
await asyncio.sleep(retry_delay)
raise Exception(f"Failed to download {url} after {max_retries} attempts.")
async def download_deb_files_parallel(mirror, packages, tmp_dir):
"""Download .deb files in parallel."""
os.makedirs(tmp_dir, exist_ok=True)
tasks = []
timeout = aiohttp.ClientTimeout(total=60)
async with aiohttp.ClientSession(timeout=timeout) as session:
for pkg, info in packages.items():
filename = info.get("Filename")
if filename:View on GitHub (pinned to 3600ca084e)