unslothai/unsloth · error · CodexTransportError
Could not reach ChatGPT Codex.
Error message
Could not reach ChatGPT Codex.
What it means
Raised when an httpx.HTTPError (connect failure, DNS error, TLS error, read timeout) occurs, the response was never yielded, and the attempt counter has reached _MAX_TRANSIENT_RETRIES. It is the terminal 'cannot reach the endpoint at all' error after exponential backoff (2**attempt seconds between tries).
Source
Thrown at studio/backend/core/inference/openai_codex_client.py:414
yield None
return
continue
if response.status_code == 429:
raise CodexQuotaError(
"ChatGPT subscription quota is temporarily unavailable.",
status = 429,
metadata = _quota_metadata(response),
)
suffix = f" {detail}" if detail else ""
raise CodexTransportError(
f"ChatGPT Codex request failed ({response.status_code}).{suffix}",
status = response.status_code,
)
except httpx.HTTPError as exc:
if yielded:
raise
if attempt >= _MAX_TRANSIENT_RETRIES:
raise CodexTransportError("Could not reach ChatGPT Codex.") from exc
await _retry_pause(float(2**attempt), cancel_event)
if cancel_event is not None and cancel_event.is_set():
yield None
return
raise CodexTransportError("Could not reach ChatGPT Codex.")
class OpenAICodexClient:
def __init__(
self,
access_token: str,
account_id: str,
*,
refresh_access: Callable[[], Awaitable[tuple[str, str]]] | None = None,
) -> None:
self._token, self._account_id = access_token, account_id
self._refresh_access = refresh_access
self._client = _create_http_client()View on GitHub (pinned to 203007d190)
Solutions
- Verify network egress to the Codex endpoint (curl/DNS lookup) from the same host
- Check firewall/proxy/VPN rules for the endpoint domain
- If truly transient, catch CodexTransportError with this message and retry later with a longer outer backoff
Defensive patterns
Strategy: retry
Validate before calling
import httpx, socket
def codex_endpoint_reachable(base_url: str) -> bool:
host = httpx.URL(base_url).host
try:
socket.gethostbyname(host)
return True
except socket.gaierror:
return False Try / catch
try:
async for chunk in stream:
...
except CodexTransportError as exc:
if 'Could not reach ChatGPT Codex' in str(exc):
await offline_backoff_then_retry(request) # long outer backoff
raise Prevention
- Pre-flight DNS/egress check in health checks so failures surface before user requests
- Size outer retry budgets larger than the client's internal _MAX_TRANSIENT_RETRIES backoff window
- Monitor network transitions (VPN/dock changes) in long-running apps
When it happens
Trigger: Every attempt in the retry loop raises httpx.HTTPError before a response arrives: DNS resolution failure, connection refused, TLS handshake error, or read timeout — with attempts exhausted.
Common situations: Offline machine; firewall blocking egress to the Codex endpoint; DNS misconfiguration; VPN dropped mid-session; endpoint temporarily unreachable for longer than the full backoff window.
Related errors
- Could not refresh ChatGPT authorization. Please retry.
- VirusTotal upload failed after {attempts} attempt(s): {last_
- ChatGPT credential update is busy. Please retry.
- Could not reach ChatGPT authentication.
- ChatGPT returned an invalid authorization response.
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/a42b9e9bfc053517.
Report an issue: GitHub.