{"record":{"id":"cfb7a3fc49e9828a","repo":"calesthio/OpenMontage","slug":"could-not-reach-atlas-cloud-at-endpoint-exc","errorCode":null,"errorMessage":"Could not reach Atlas Cloud at {endpoint}: {exc}","messagePattern":"Could not reach Atlas Cloud at (.+?): (.+?)","errorType":"exception","errorClass":"AtlasError","httpStatus":null,"severity":"error","filePath":"tools/atlas_client.py","lineNumber":116,"sourceCode":"def _raise_for_status(response: Any, context: str) -> None:\n    status = getattr(response, \"status_code\", 200)\n    if status >= 400:\n        text = getattr(response, \"text\", \"\")\n        raise AtlasError(f\"{context} failed with HTTP {status}: {text[:500]}\")\n\n\ndef submit(endpoint: str, payload: dict[str, Any], api_key: str, timeout: int = 60) -> str:\n    \"\"\"Submit a generation request and return its prediction id.\"\"\"\n    import requests\n\n    try:\n        response = requests.post(\n            endpoint, headers=_headers(api_key), json=payload, timeout=timeout\n        )\n    except AtlasError:\n        raise\n    except Exception as exc:  # noqa: BLE001\n        raise AtlasError(f\"Could not reach Atlas Cloud at {endpoint}: {exc}\") from exc\n\n    _raise_for_status(response, \"Atlas Cloud submission\")\n    data = _payload_of(response)\n\n    prediction_id = data.get(\"id\")\n    if not prediction_id:\n        raise AtlasError(f\"Atlas Cloud did not return a prediction id: {str(data)[:500]}\")\n    return str(prediction_id)\n\n\ndef poll(\n    prediction_id: str,\n    api_key: str,\n    interval: float = 3.0,\n    timeout: float = 600.0,\n    request_timeout: int = 30,\n) -> dict[str, Any]:\n    \"\"\"Poll a prediction until it terminates. Returns the final `data` object.","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/atlas_client.py#L98-L134","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry with backoff — connection blips and short timeouts usually clear","Increase the timeout argument if the exception text mentions ReadTimeout","Verify network egress: curl the Atlas base URL from the same host/environment","Behind a MITM proxy, set REQUESTS_CA_BUNDLE to the proxy's root CA"],"exampleFix":"// before\npid = atlas_client.submit(endpoint, payload, api_key)\n\n// after\npid = atlas_client.submit(endpoint, payload, api_key, timeout=120)","handlingStrategy":"retry","validationCode":"import socket\ntry:\n    socket.getaddrinfo(host_of(endpoint), 443)\nexcept socket.gaierror:\n    raise RuntimeError(f\"cannot resolve Atlas host; check DNS/network: {endpoint}\")","typeGuard":null,"tryCatchPattern":"for attempt in range(3):\n    try:\n        pid = atlas_client.submit(endpoint, payload, api_key, timeout=120)\n        break\n    except AtlasError as e:\n        if \"Could not reach\" not in str(e) or attempt == 2:\n            raise\n        time.sleep(5 * (attempt + 1))","preventionTips":["Set the timeout argument generously for submission (models with queues respond slowly)","Verify egress/DNS to the Atlas host in deployment environments before first use","Trust the proxy CA bundle (REQUESTS_CA_BUNDLE) in MITM-proxy environments"],"tags":["atlas-cloud","network","dns","tls","timeout"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}