langchain-ai/deepagents · error · TimeoutError

Download of {url} exceeded {_DOWNLOAD_TIMEOUT_SECONDS}s dead

Error message

Download of {url} exceeded {_DOWNLOAD_TIMEOUT_SECONDS}s deadline

What it means

`_download_to` raises `TimeoutError` when downloading a managed tool (e.g. ripgrep) exceeds the fixed `_DOWNLOAD_TIMEOUT_SECONDS` deadline, measured with `time.monotonic()`. This prevents a stalled connection from hanging installation indefinitely.

Source

Thrown at libs/code/deepagents_code/managed_tools.py:569

    import time
    import urllib.error
    import urllib.request

    deadline = time.monotonic() + _DOWNLOAD_TIMEOUT_SECONDS
    with (
        urllib.request.urlopen(url, timeout=_DOWNLOAD_TIMEOUT_SECONDS) as resp,  # noqa: S310  # fixed https GitHub release URL
        dest.open("wb") as fh,
    ):
        status = getattr(resp, "status", None)
        if status is not None and status != 200:  # noqa: PLR2004  # HTTP 200 OK
            msg = f"Unexpected HTTP {status} response fetching {url}"
            raise urllib.error.URLError(msg)
        while True:
            if time.monotonic() > deadline:
                msg = (
                    f"Download of {url} exceeded {_DOWNLOAD_TIMEOUT_SECONDS}s deadline"
                )
                raise TimeoutError(msg)
            chunk = resp.read(_DOWNLOAD_CHUNK_BYTES)
            if not chunk:
                break
            fh.write(chunk)


def _sha256(path: Path) -> str:
    """Return the SHA-256 hex digest of `path`."""
    import hashlib

    digest = hashlib.sha256()
    with path.open("rb") as fh:
        for chunk in iter(lambda: fh.read(1 << 20), b""):
            digest.update(chunk)
    return digest.hexdigest()


def _verify_sha256(path: Path, expected_hex: str) -> None:

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Retry the install when the network is faster (the operation is safe to rerun)
  2. Pre-provision the tool manually so the download path is skipped, or point any configured mirror/download URL at a faster host
  3. Check proxy/VPN throughput and disable throttling middleboxes; if a proxy is required, ensure it is configured for the process

Example fix

// before
$ dcode install-tools   # times out on hotel Wi-Fi
// after
$ networksetup -setairportpower en0 off && networksetup -setairportpower en0 on  # reset link
$ dcode install-tools     # retry once connection is stable
// or pre-provision rg on PATH so no download is needed
Defensive patterns

Strategy: retry

Validate before calling

import socket

# quick reachability probe before starting the (deadline-bound) download
host = "github.com"
try:
    socket.create_connection((host, 443), timeout=5).close()
except OSError:
    raise SystemExit("no network connectivity; fix connection before install")

Try / catch

try:
    _install_ripgrep_sync()
except TimeoutError as exc:
    logger.warning("tool download too slow: %s; retrying once", exc)
    _install_ripgrep_sync()  # retry, or fall back to system rg if present

Prevention

When it happens

Trigger: `_install_ripgrep_sync` triggering a download on a slow or throttled network, a stalled/stuck connection where `resp.read()` blocks, or a very large artifact on a low-bandwidth link (VPN, corporate proxy, CI runner with limited egress).

Common situations: Flaky Wi-Fi or satellite links; corporate proxies buffering slowly; CI runners in constrained regions; GitHub release CDN throttling.

Understand the failure class

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/4abfeadd857d9ad4. Report an issue: GitHub.