calesthio/OpenMontage · error · AtlasError

Uploading {path.name} to Atlas Cloud failed: {exc}

Error message

Uploading {path.name} to Atlas Cloud failed: {exc}

What it means

Raised by upload_media when the multipart POST to the Atlas upload endpoint throws any exception — connection failure, TLS error, or requests timeout (default 120s). Opening the file locally has already succeeded; the failure is purely in transit or at the server's front door. The exception is chained for full detail.

Source

Thrown at tools/atlas_client.py:209

    models expect. Atlas has answered this endpoint with both {"data":
    {"download_url": ...}} and a bare {"url": ...}, so both shapes are accepted.
    """
    import requests

    path = Path(file_path)
    if not path.exists():
        raise AtlasError(f"Cannot upload — file not found: {path}")

    try:
        with path.open("rb") as handle:
            response = requests.post(
                UPLOAD_MEDIA_ENDPOINT,
                headers=_headers(api_key, json_body=False),
                files={"file": (path.name, handle)},
                timeout=timeout,
            )
    except Exception as exc:  # noqa: BLE001
        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

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. If the message mentions timeout, raise the timeout argument proportional to file size and bandwidth
  2. Compress or resize the media before upload (smaller dimensions/CRF) to shrink transfer time
  3. Retry once — transient resets are common for large uploads
  4. Verify egress to the upload endpoint and bypass restrictive proxies

Example fix

// before
url = atlas_client.upload_media(path, api_key)

// after
url = atlas_client.upload_media(path, api_key, timeout=600)
Defensive patterns

Strategy: retry

Validate before calling

size_mb = path.stat().st_size / (1024 * 1024)
timeout = max(120, int(size_mb * 4))  # ~4s/MB heuristic for slow links

Try / catch

for attempt in range(2):
    try:
        url = atlas_client.upload_media(path, api_key, timeout=timeout)
        break
    except AtlasError as e:
        if "Uploading" not in str(e) or attempt == 1:
            raise
        time.sleep(10)

Prevention

When it happens

Trigger: Uploading a large video over a slow link exceeding the 120s default timeout; connection reset by the server due to body-size limits enforced at the TCP/proxy layer; DNS/TLS failures reaching the upload host; proxy rejection of multipart content.

Common situations: Reference videos in the hundreds of MB with default timeout; mobile or constrained uplinks; corporate proxies blocking large POST bodies; transient cloud-front blips during upload.

Related errors


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