dbt-labs/dbt-core · error · RuntimeError
failed to download {url}: {last}
Error message
failed to download {url}: {last} What it means
`_fetch` downloads the prebuilt wheel from the manifest's `base_url` with up to `_RETRIES` (4) attempts and exponential backoff. If every attempt fails with URLError, TimeoutError, or OSError, it raises RuntimeError including the URL and the last exception. It exists because the sdist ships no code — the wheel must be fetched at install time.
Source
Thrown at crates/dbt-ci/templates/sdist_build_backend.py:92
tty.write(text + "\n\n\n")
except (OSError, ValueError):
pass
def _fetch(url):
last = None
for attempt in range(1, _RETRIES + 1):
try:
req = urllib.request.Request(
url, headers={"User-Agent": "{}-sdist".format(_MANIFEST["name"])}
)
with urllib.request.urlopen(req, timeout=_TIMEOUT) as resp:
return resp.read()
except (urllib.error.URLError, TimeoutError, OSError) as exc:
last = exc
if attempt < _RETRIES:
time.sleep(2 ** (attempt - 1))
raise RuntimeError(f"failed to download {url}: {last}")
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
_emit_notice()
entry = _select_wheel()
filename = entry["filename"]
url = "{base}/{file}".format(base=_MANIFEST["base_url"].rstrip("/"), file=filename)
data = _fetch(url)
digest = hashlib.sha256(data).hexdigest()
if digest != entry["sha256"]:
raise RuntimeError(
f"sha256 mismatch for {filename}: expected {entry['sha256']}, got {digest}"
)
out = Path(wheel_directory) / filename
out.write_bytes(data)
return filenameView on GitHub (pinned to 0267ce9170)
Solutions
- Check network connectivity and proxy settings (HTTPS_PROXY/HTTP_PROXY) in the install environment
- Verify the URL from the error message is reachable (curl it) — if 404, the release asset is missing
- Retry the install later if it's a transient CDN/network outage
- Pre-download the wheel and install it directly, or use a mirror of the release assets
- Use a release version whose assets are confirmed published
Example fix
# before (no egress in CI) pip install mypkg # after export HTTPS_PROXY=http://proxy.corp:3128 pip install mypkg
Defensive patterns
Strategy: retry
Validate before calling
import urllib.request
def url_reachable(url: str) -> bool:
try:
return urllib.request.urlopen(url, timeout=10).status == 200
except Exception:
return False
# check base_url + filename before installing Try / catch
try:
build_wheel(wheel_dir)
except RuntimeError as e:
if 'failed to download' in str(e):
time.sleep(30)
build_wheel(wheel_dir) # retry once on transient network failure
else:
raise Prevention
- Ensure install environments (CI runners) have egress or correct proxy env vars
- Pre-download wheels and install from local files in air-gapped setups
- Verify release assets are published before announcing/releasing a version
- Retry transient failures; the backend already backs off 4 times
When it happens
Trigger: `build_wheel` (via `_fetch`) cannot download `{base_url}/{filename}`: DNS failure, no network, proxy/firewall blocking, HTTP 4xx/5xx surfacing as URLError (e.g. HTTPError), asset missing from the release store, or all attempts timing out after 60s each.
Common situations: CI runners without internet egress or behind a corporate proxy; the release asset was deleted or never uploaded; transient registry/CDN outage exhausting the 4 retries; TLS interception producing SSL errors.
Related errors
- GET {url} failed: {status}
- An unexpected error occurred during package installation: {e
- no prebuilt {name} {ver} wheel for this platform; available
- upload {filename} failed: {status} {body}
- POST {url}
AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07).
Data as JSON: /api/errors/369d8f35054e5237.
Report an issue: GitHub.