calesthio/OpenMontage · error · AtlasError

Polling prediction {prediction_id} failed after {consecutive

Error message

Polling prediction {prediction_id} failed after {consecutive_transport_errors} consecutive transport errors: {exc}

What it means

Raised inside the poll loop when five consecutive HTTP requests to fetch the prediction fail at the transport layer (exceptions from requests.get: timeouts, connection resets, DNS blips). A single transport error is tolerated with a sleep-and-retry; five in a row means the connection to Atlas is effectively down and polling aborts instead of burning the whole timeout silently.

Source

Thrown at tools/atlas_client.py:153

    Raises AtlasError on reported failure or when `timeout` seconds elapse.
    """
    import requests

    url = f"{PREDICTION_ENDPOINT}/{prediction_id}"
    elapsed = 0.0
    last_status = "unknown"
    consecutive_transport_errors = 0

    while elapsed < timeout:
        try:
            response = requests.get(
                url, headers=_headers(api_key, json_body=False), timeout=request_timeout
            )
        except Exception as exc:  # noqa: BLE001
            consecutive_transport_errors += 1
            if consecutive_transport_errors >= 5:
                raise AtlasError(
                    f"Polling prediction {prediction_id} failed after "
                    f"{consecutive_transport_errors} consecutive transport errors: {exc}"
                ) from exc
            time.sleep(interval)
            elapsed += interval
            continue

        _raise_for_status(response, f"Atlas Cloud poll for {prediction_id}")
        consecutive_transport_errors = 0
        data = _payload_of(response)
        last_status = str(data.get("status", "unknown")).lower()

        if last_status in TERMINAL_SUCCESS:
            outputs = data.get("outputs") or []
            if not outputs:
                raise AtlasError(
                    f"Prediction {prediction_id} reported '{last_status}' but returned no outputs."
                )

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Check network stability to the Atlas host (the prediction itself may still be running — resubmit only a poll, not the generation, if you saved the prediction id)
  2. Increase request_timeout if the exception is a ReadTimeout on each poll
  3. Retry the poll() call with the same prediction_id after connectivity returns
  4. For long jobs, poll less frequently (larger interval) to reduce exposure windows

Example fix

// before
data = atlas_client.poll(pid, api_key)

// after — resume polling with the same id, longer per-request timeout
data = atlas_client.poll(pid, api_key, interval=5.0, request_timeout=60)
Defensive patterns

Strategy: retry

Try / catch

try:
    data = atlas_client.poll(pid, api_key, interval=5.0, request_timeout=60)
except AtlasError as e:
    if "consecutive transport errors" in str(e):
        time.sleep(30)  # let connectivity recover
        data = atlas_client.poll(pid, api_key, interval=5.0, request_timeout=60)  # same pid — no resubmit
    else:
        raise

Prevention

When it happens

Trigger: Long video generations (10+ minutes) polled every few seconds while the network drops (laptop sleep, Wi-Fi roam, VPN reconnect); a proxy going down mid-poll; request_timeout (default 30s) too small for slow poll responses, making each poll time out consecutively.

Common situations: Mobile/intermittent networks running long renders; VPN token expiring mid-job; Atlas endpoints briefly unreachable while the prediction itself continues server-side; aggressive NAT idle timeouts killing keep-alive connections.

Related errors


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