calesthio/OpenMontage · error · AtlasError

Could not reach Atlas Cloud at {endpoint}: {exc}

Error message

Could not reach Atlas Cloud at {endpoint}: {exc}

What it means

Raised by submit when requests.post to the Atlas endpoint throws any non-AtlasError exception — connection refused, DNS failure, TLS error, or request timeout (requests.Timeout). It means the request never got an HTTP response at all, so this is a reachability problem, not an API rejection.

Source

Thrown at tools/atlas_client.py:116

def _raise_for_status(response: Any, context: str) -> None:
    status = getattr(response, "status_code", 200)
    if status >= 400:
        text = getattr(response, "text", "")
        raise AtlasError(f"{context} failed with HTTP {status}: {text[:500]}")


def submit(endpoint: str, payload: dict[str, Any], api_key: str, timeout: int = 60) -> str:
    """Submit a generation request and return its prediction id."""
    import requests

    try:
        response = requests.post(
            endpoint, headers=_headers(api_key), json=payload, timeout=timeout
        )
    except AtlasError:
        raise
    except Exception as exc:  # noqa: BLE001
        raise AtlasError(f"Could not reach Atlas Cloud at {endpoint}: {exc}") from exc

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

    prediction_id = data.get("id")
    if not prediction_id:
        raise AtlasError(f"Atlas Cloud did not return a prediction id: {str(data)[:500]}")
    return str(prediction_id)


def poll(
    prediction_id: str,
    api_key: str,
    interval: float = 3.0,
    timeout: float = 600.0,
    request_timeout: int = 30,
) -> dict[str, Any]:
    """Poll a prediction until it terminates. Returns the final `data` object.

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Retry with backoff — connection blips and short timeouts usually clear
  2. Increase the timeout argument if the exception text mentions ReadTimeout
  3. Verify network egress: curl the Atlas base URL from the same host/environment
  4. Behind a MITM proxy, set REQUESTS_CA_BUNDLE to the proxy's root CA

Example fix

// before
pid = atlas_client.submit(endpoint, payload, api_key)

// after
pid = atlas_client.submit(endpoint, payload, api_key, timeout=120)
Defensive patterns

Strategy: retry

Validate before calling

import socket
try:
    socket.getaddrinfo(host_of(endpoint), 443)
except socket.gaierror:
    raise RuntimeError(f"cannot resolve Atlas host; check DNS/network: {endpoint}")

Try / catch

for attempt in range(3):
    try:
        pid = atlas_client.submit(endpoint, payload, api_key, timeout=120)
        break
    except AtlasError as e:
        if "Could not reach" not in str(e) or attempt == 2:
            raise
        time.sleep(5 * (attempt + 1))

Prevention

When it happens

Trigger: DNS resolution failure for the Atlas host; connection refused during an outage; TLS certificate verification failure behind MITM proxies; requests timeout because timeout (default 60s) is shorter than Atlas's response time for the initial submission.

Common situations: Firewall or security groups blocking egress to Atlas; corporate MITM proxy with an untrusted CA; timeout too small for queued submissions on busy models; transient ISP/DNS failures in CI runners.

Related errors


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