calesthio/OpenMontage · error · AtlasError

Downloading Atlas Cloud output failed: {exc}

Error message

Downloading Atlas Cloud output failed: {exc}

What it means

Raised by download when requests.get for a generated asset URL throws any exception — DNS failure, TLS error, connection reset, or the 300s default timeout being exceeded for very large outputs on slow links. The asset was generated successfully and the URL is known; only the final fetch failed. The path writing step is never reached.

Source

Thrown at tools/atlas_client.py:227

        raise AtlasError(f"Uploading {path.name} to Atlas Cloud failed: {exc}") from exc

    _raise_for_status(response, "Atlas Cloud upload")
    data = _payload_of(response)

    url = data.get("download_url") or data.get("url")
    if not url:
        raise AtlasError(f"Atlas Cloud upload returned no URL: {str(data)[:500]}")
    return str(url)


def download(url: str, output_path: str | Path, timeout: int = 300) -> Path:
    """Download a generated asset to disk and return the written path."""
    import requests

    try:
        response = requests.get(url, timeout=timeout)
    except Exception as exc:  # noqa: BLE001
        raise AtlasError(f"Downloading Atlas Cloud output failed: {exc}") from exc

    _raise_for_status(response, "Atlas Cloud output download")

    path = Path(output_path)
    path.parent.mkdir(parents=True, exist_ok=True)
    path.write_bytes(response.content)
    return path


def aspect_ratio_from_size(width: int, height: int, allowed: list[str]) -> str:
    """Pick the closest ratio in `allowed` to width/height.

    OpenMontage's canonical params are width/height, but many Atlas models only
    accept a ratio enum. Snapping to the nearest supported ratio beats sending a
    value the model will reject.
    """
    if not allowed:
        return "16:9"

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Increase the timeout argument for large video outputs (e.g. 900-1800s)
  2. If the URL expired (usually a 403 wrapped in this path or a reset), re-poll the prediction to obtain a fresh URL
  3. Retry the download — CDN resets on big files are common and a retry often completes
  4. Download promptly after generation completes rather than much later

Example fix

// before
path = atlas_client.download(url, "out/video.mp4")

// after
path = atlas_client.download(url, "out/video.mp4", timeout=1200)
Defensive patterns

Strategy: retry

Validate before calling

timeout = max(300, int(expected_mb * 6))  # scale to output size before downloading

Try / catch

for attempt in range(3):
    try:
        path = atlas_client.download(url, out_path, timeout=timeout)
        break
    except AtlasError as e:
        if "Downloading Atlas Cloud output failed" not in str(e) or attempt == 2:
            raise
        time.sleep(5 * (attempt + 1))

Prevention

When it happens

Trigger: Downloading a multi-hundred-MB generated video over slow bandwidth exceeding 300s; the hosted URL expiring (signed URLs) between generation completion and download; CDN edge issues resetting large transfers.

Common situations: Long queues between generation and download letting signed URLs lapse; bandwidth-constrained CI runners; retrying an old prediction's URL after its retention window; interrupted transfers on mobile networks.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/1059ebb2837d274d. Report an issue: GitHub.