top of page

OpenAI Responses API stream fails with "server_is_overloaded" after a 200: why retries never fire

13 minutes ago
8 min read
OpenAI logo with the title OpenAI Responses API stream fails with server_is_overloaded after a 200, Data Studios original cover

Last verified: November 30, 2026


A streamed call to the OpenAI Responses API can start normally, return HTTP 200, emit its first events and then stop with "Our servers are currently overloaded. Please try again later." The request is never retried, even when the client has retries switched on, and in agent frameworks the fallback model you configured never takes over. The overload arrived inside the stream, after the HTTP request had already succeeded, and most client retry logic only looks at the HTTP status of the initial request. The fix lives in your code: read the stream's error events, treat the overload codes as temporary, and send the whole request again with a backoff.


The pattern has been reported independently in several projects during November 2026: in the Vercel AI SDK, where maxRetries makes a single fetch call when the overload comes mid-stream; in agent tools built on the Responses API, where an in-stream overload loses its error code and is classified as an unknown error; and in the official Python SDK's issue tracker, where a contributor pointed out that the library retries the initial request and not failures that surface while the stream is being read. It can affect any model served through the Responses API with stream=True, on the OpenAI platform and on Azure-hosted deployments that use the same streaming format. A capacity problem on OpenAI's side is the trigger; the missing retry is a client-side gap that turns a brief overload into a failed task.


··········


HOW THE OPENAI OVERLOAD ERROR LOOKS INSIDE A RESPONSES STREAM.


Without streaming, an overload is easy to spot. OpenAI's error-code guide lists it as HTTP 503 with type service_unavailable_error and code server_is_overloaded, describes the cause as a temporarily overloaded model, and tells clients to follow the Retry-After header when it is present and then retry. The official Python library retries status codes of 500 and above by default, so a 503 returned before the stream opens is usually absorbed without the application noticing.


Once the server has answered 200 and started sending server-sent events, it can no longer change the status code. A failure from that point on travels as an event in the stream. The Responses API reference documents two event types for this: error, described as emitted when an error occurs, with the fields type, code, message, param and sequence_number; and response.failed, which carries the full response object with status: "failed" and an error object holding a code and a message. The frames below are the ones reported in public bug reports this month.


........


Where it appears

Exact payload or text reported

SSE error event (Vercel AI SDK report)

{"type":"error","sequence_number":2,"code":"server_is_overloaded","message":"Our servers are currently overloaded. Please try again later.","param":null}

SSE error event (agent framework report)

{"type":"error","code":"server_error","message":"The server is overloaded.","param":null}

Terminal response.failed event

response.status "failed" with response.error.code "server_error" (official example message: "The model failed to generate a response.")

Same overload before the stream opens

HTTP 503, type service_unavailable_error, code server_is_overloaded, optional Retry-After header


........


The low sequence number in the first frame is typical of these reports: the stream had already sent response.created and response.in_progress, so the client considered the request accepted, and the overload came a moment later.


··········


WHY OPENAI SDK AND FRAMEWORK RETRIES SKIP IN-STREAM OVERLOADS.


The official Python library states the rule plainly in its README. It retries connection errors, 408, 409, 429 and errors of 500 and above twice by default with a short exponential backoff, and it adds that stream consumption is not automatically retried, because replaying a request could duplicate output already delivered to the application. The retry budget you set with max_retries therefore applies to opening the stream and stops there. A comment in the Python SDK issue tracker describes the same behavior for rate-limit errors that arrive while a Responses stream is being read, and notes that Chat Completions surfaces some of those errors earlier, at stream creation, where they are retried.


Frameworks add their own layers on top, and each one has a point after which an error is no longer treated as retryable. The table maps the causes reported so far to a check and a fix.


........


Cause

How to check

Fix

Overload sent as an SSE error event after HTTP 200

Log raw events; look for type "error" with code server_is_overloaded or server_error

Treat those codes as temporary and resend the whole request with backoff

Stream ends with response.failed and the client accepts it as a result

Check the terminal event type and response.status before using the output

Raise on failed status; retry when error.code is server_error or server_is_overloaded

SDK retries cover only the initial request

Retries configured, yet the logs show a single HTTP call per failed task

Wrap stream consumption in your own retry loop

Vercel AI SDK only retries errors in a 50 ms window after the stream starts

ai 7.0.169 to 7.0.181 with @ai-sdk/openai 4.0.114 to 4.0.123; error shows isRetryable: true but one fetch call

Retry around streamText yourself until the provider is fixed; follow issue 25478

Error code dropped when the stream error is rethrown as plain text

Error string reads "Error Code server_error: ..." and your classifier returns unknown

Parse or preserve the code so fallback and retry rules can match it

A real capacity incident on OpenAI's side

status.openai.com shows an incident for the model or the Responses API

Back off longer, follow Retry-After, or switch to a fallback model


........


··········


FIXING SERVER_IS_OVERLOADED IN YOUR OWN OPENAI CLIENT CODE.


The repair is the same whichever SDK you use: the code that consumes the stream must decide what counts as a temporary failure, because the SDK will not decide for it once events are flowing.


1. Listen for both failure events. OpenAI's streaming guide lists error among the common events to listen for, and its TypeScript example handles it with a branch that only logs event.message. Logging is the minimum; your loop also needs to stop reading and report the code to the caller. Handle response.failed the same way, reading event.response.error.code.


2. Classify the code. server_is_overloaded and server_error describe conditions on OpenAI's side that the error guide tells you to retry after a wait. Codes tied to the request itself (an invalid parameter, a context that is too long, a refusal) will fail again and should not be retried.


3. Discard partial output before retrying. A retried stream starts from the beginning, so text already shown to the user or stored in a buffer has to be cleared or replaced, otherwise the answer is duplicated. This is the exact reason the Python SDK refuses to retry streams on its own.


4. Back off and cap the attempts. The error guide asks clients to wait at least as long as Retry-After when the header is present and otherwise to increase the delay between retries. In-stream events carry no headers, so use an increasing delay with a little random jitter and stop after a small number of attempts.


5. Do not replay steps that had side effects. When the model already called a tool that changed something (sent a message, ran code, wrote a file), a blind retry repeats the action. One agent framework's tracker describes exactly this case, where fallback was blocked after a code-execution step because replaying it was unsafe. Retry only from a point where repeating the call is harmless, or resume from saved state.


The official Python library lets you set the retry budget for the initial request; the README's example is copied below.


client = OpenAI(
    # default is 2
    max_retries=0,
)
client.with_options(max_retries=5).chat.completions.create(

For the stream itself you need a wrapper. The following Python sketch is illustrative, written for this page and not taken from OpenAI's documentation; it shows the structure of a retry around stream consumption that handles both the event form and the exception form of the failure.


# Illustrative only: not from OpenAI's docs. Adapt model, limits and logging.
import random, time
import openai
from openai import OpenAI

client = OpenAI()
RETRYABLE = {"server_is_overloaded", "server_error"}

def stream_with_retry(request, attempts=4):
    for attempt in range(attempts):
        chunks, failure = [], None
        try:
            for event in client.responses.create(stream=True, **request):
                if event.type == "response.output_text.delta":
                    chunks.append(event.delta)
                elif event.type == "error":
                    failure = event.code
                    break
                elif event.type == "response.failed":
                    failure = event.response.error.code if event.response.error else None
                    break
        except openai.APIError as e:
            failure = getattr(e, "code", None)
        if failure is None:
            return "".join(chunks)
        if failure not in RETRYABLE or attempt == attempts - 1:
            raise RuntimeError(f"Responses stream failed: {failure}")
        time.sleep(min(30, 2 ** attempt) + random.random())

The text is collected and returned only after the stream completes, so a failed attempt leaves nothing on screen to clean up. If your interface prints tokens as they arrive, reset the visible answer at the start of each attempt instead.


··········


VERCEL AI SDK, OPENAI AGENTS SDK AND OTHER FRAMEWORKS: WHAT IS REPORTED.


In the Vercel AI SDK, issue 25478 explains the mechanism in detail. The OpenAI provider hands the stream to the caller once it sees response.in_progress and keeps watching for early failures for a 50 millisecond grace period; errors inside that window are retried, later ones become an error part of the stream and are not. The reporter traced it to an earlier change in the provider and confirmed the behavior with ai 7.0.181 and @ai-sdk/openai 4.0.123. As of November 30 the issue sits in the backlog with no linked fix, so the reliable path is a retry around streamText in your own code, triggered by the error part, using the same rules as above.


The OpenAI Agents SDK for Python has two open reports in this area. Issue 3106 says the streaming model treats response.failed and response.incomplete terminal events as a successful final response, so partial output from a failed response can flow into the run as if nothing went wrong. Issue 5181 says the stream wrapper does not count a bare error event as terminal, so a failure while closing the connection can hide the provider's real error; the reporter prepared a one-line fix locally. Neither report shows a maintainer response on its page.


Smaller tools have already shipped fixes. The browsercode project now parses nested response.failed events and turns server_error and server_is_overloaded into retryable errors that go through its existing retry policy. The ECA editor assistant treats SSE error events as terminal, keeps the structured error fields and request IDs, and classifies server_is_overloaded as a retryable overload. A third project, built on a vendored copy of the pi-ai library, documented that rethrowing stream failures as plain text strips the code, so its fallback logic sees an unknown error and never switches models.


Everything in this section comes from public issue trackers and pull requests. OpenAI documents the event schemas and the retry advice for HTTP errors; it does not document how SDKs should treat overloads that arrive inside a stream, and the behavior described here is the reporters' analysis of their own code.


··········


WHEN SERVER_IS_OVERLOADED MEANS AN OPENAI CAPACITY INCIDENT.


The client fix removes the failed tasks, but the overload itself comes from OpenAI's side. When the errors cluster in time or affect one model only, check status.openai.com for an open incident on the model or on the Responses API; during an incident, retries with short delays mostly add load. In that situation a longer backoff, a lower request rate or a temporary switch to another model works better than more attempts. A steady trickle of in-stream overloads on a healthy status page points back to the client gap, where retries alone are enough.


The same capacity signals show up across providers in different forms. Gemini returns its own 503 "high demand" error, covered in our guide to the Gemini API 503 unavailable error, and Codex users see a closely related symptom as a stream that reconnects and then gives up, explained in Codex keeps reconnecting: stream disconnected before completion. A Responses stream that ends early for a different reason, a reply cut off by the output limit, is a separate case covered in Codex and the Responses API incomplete response with max_output_tokens.


··········


SERVER_IS_OVERLOADED IN OPENAI STREAMS: CONCLUSIONS FOR DEVELOPERS.


An overload that arrives after HTTP 200 is a normal part of the Responses API's streaming design, documented through the error and response.failed events, and the official Python library says outright that it will not retry a stream once consumption has begun. Applications that rely on the SDK's max_retries setting, or on a framework's retry and fallback options, therefore lose requests during busy periods, even though OpenAI's own guide treats an overload as something to wait out and retry.


The dependable fix is a small amount of code you own: inspect both failure events, retry server_is_overloaded and server_error with an increasing delay, clear partial output before each attempt, and never replay tool calls with side effects. Framework users should add that wrapper now rather than wait for the Vercel AI SDK and Agents SDK reports to be closed, and should remove it only once a release note confirms in-stream overloads are retried by the library itself.


··········


FOLLOW US FOR MORE.


·····


DATA STUDIOS


·····


datastudios.org


bottom of page