unslothai/unsloth · error · CodexTransportError
ChatGPT Codex request failed ({response.status_code}).{suffi
Error message
ChatGPT Codex request failed ({response.status_code}).{suffix} What it means
The generic non-success fallback for the Codex responses endpoint: any status that is not 2xx, 3xx (handled as forbidden redirect), 401 (auth refresh path), or 429 (quota path) becomes CodexTransportError with the status code and any upstream error detail extracted from the body. This is the error that surfaces upstream 4xx/5xx bodies.
Source
Thrown at studio/backend/core/inference/openai_codex_client.py:406
metadata = {"access_token": token},
)
retryable = response.status_code in _RETRYABLE_STATUSES and not _is_terminal_quota(
detail
)
if retryable and attempt < _MAX_TRANSIENT_RETRIES:
await _retry_pause(_retry_delay_seconds(response, attempt), cancel_event)
if cancel_event is not None and cancel_event.is_set():
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,View on GitHub (pinned to 203007d190)
Solutions
- Log the status code and detail suffix — they come straight from the upstream body and identify the cause
- For 4xx, fix the request payload (model id, parameters, size) — retries will not help
- For 5xx, retry with backoff; check the OpenAI status page for incidents
Defensive patterns
Strategy: try-catch
Try / catch
try:
async for chunk in client.stream(request):
...
except CodexTransportError as exc:
status = exc.status
if 400 <= status < 500 and status not in (408, 429):
log_upstream_detail(exc) # do not retry client errors
raise
await retry_with_backoff(request) # 5xx path Prevention
- Validate request payloads (model id, sizes) client-side before sending
- Log the detail suffix — it carries the upstream error body verbatim
- Subscribe to API changelogs when using newer responses-API features
When it happens
Trigger: Endpoint returns e.g. 400 (bad request payload), 403 (forbidden/plan restriction), 500/502/503 (upstream failure) after retry budget for retryable statuses is spent or the status is non-retryable. detail comes from _upstream_error_detail(response).
Common situations: Malformed or oversized request payload (400); model not enabled for the account (403); upstream OpenAI incident (5xx); passing unsupported parameters through to the responses API.
Related errors
- ChatGPT Codex endpoint returned a forbidden redirect.
- ChatGPT Codex generation failed{f' ({code})' if code else ''
- family {getattr(fam, 'name', fam)!r} declares no prequant_fi
- lockfile not found: {path}
- load timed out (last progress: {prog})
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/4ca962453c06cbe3.
Report an issue: GitHub.