GPT Image 2.5 is live — OpenAI's newest image model, targeted edits that leave the rest of the frame alone
All resources

· reAPI Team

stream disconnected before completion: stream closed before response.completed

Codex reached the end of a stream without accepting completion. Check the full error, terminal event, timeout and endpoint protocol before retrying.

stream disconnected before completion: stream closed before response.completed

“stream disconnected before completion: stream closed before response.completed” means that Codex reached the end of a response stream without accepting a completion event. It identifies where processing stopped, not which machine caused it. In the Codex SSE reader inspected on October 22, 2026, this message is the end-of-stream fallback; transport failures, idle timeouts and a previously received server error have separate paths.[1]

Read the full suffix before changing settings. A closed stream needs an event trace; an idle timeout needs timing evidence; a rate limit needs the service's limiting dimension. If you are evaluating reAPI, check the GPT-6 Astra request documentation first: that page documents Chat Completions. A working Chat Completions request does not establish compatibility with Codex's Responses protocol.[2][3]

Start here

  • Save the full error, client version, timestamp and request ID before retrying. Keep credentials and private prompt content out of shared reports.
  • For an early close, inspect whether the received SSE data contains a valid, accepted terminal event, rather than relying on HTTP success or visible text alone.[1]
  • For idle timeout waiting for SSE, measure the gap between events. The documented idle control is distinct from request and stream retry counts.[2]
  • For a temporary rate limit, follow the service's retry hint and reduce the relevant load. Quota or billing errors need account action instead.[4]

stream disconnected before completion: stream closed before response.completed

The source gives a narrower answer than “your internet is broken.” The SSE loop reads events, deserializes their JSON and passes recognized events to the Responses handler. When the handler returns a completed response, the loop finishes successfully. When the input ends first, it returns a remembered response error if one exists; otherwise it emits the closed-stream message.[1]

This creates useful distinctions when reviewing a trace:

ObservationWhat it establishesNext diagnostic step
Text arrived, then the stream endedSome output reached the clientLook for the terminal event and its JSON body
HTTP success, but no accepted completionThe HTTP request succeeded at that layerInspect the event sequence rather than treating the task as complete
A terminal-looking payload is presentBytes resembling a completion arrivedCheck the event type, required response fields and the installed client's parser
A saved server failure precedes EOFThe service supplied an errorDiagnose that error before treating the close as a separate network failure

These are interpretations of the reviewed parser, not results from a live reAPI call. The article uses an immutable source revision, c2d5ea52, so you can compare its behavior with your installed client instead of assuming every Codex release behaves identically.[1]

Malformed data deserves a specific check. In this revision, an event that fails the initial JSON deserialization is logged and skipped. A recognized completion with an invalid response object takes a different error path. Therefore, merely finding the string response.completed in a log does not show that Codex accepted it. Conversely, a closed stream alone does not prove that the server omitted the event: compare what the server sent with what the client received.[1]

For a custom endpoint, check its documented protocol before increasing retries. The current configuration reference lists responses as the supported wire_api value and describes WebSocket support as a separate provider capability. An endpoint that accepts OpenAI-shaped Chat Completions JSON is not, by that fact alone, a working Responses endpoint.[2]

Our suggested reproduction sequence is deliberately small: one text-only request, then the same streaming request, then the tool interaction that originally failed. Keep the endpoint, key and model fixed between steps. Record what changes at each step; this is a diagnostic method, not a guarantee that every provider supports all three tests. If a test incurs usage charges, run only what you have approved for that account.

stream disconnected before completion: transport error: network error: error decoding response body

This query describes a transport/body-reading failure. The Codex SSE reader can surface an error from the incoming event stream before it receives the next usable event. That differs from the normal end-of-stream branch above.[1]

Treat the individual components as investigation points, not a list of proven causes. Record the final endpoint host, client version, HTTP status if available, elapsed time and whether any response events arrived. Then compare one controlled change at a time, such as another approved network path or the same endpoint outside the affected client. A successful browser visit to a website does not test the particular authenticated stream that failed.

OpenAI's error guidance recommends checking network settings, proxy configuration, SSL certificates and firewall rules for API connection errors. That guidance supplies checks to perform; it does not diagnose the exact error string in your environment.[5] Keep certificate verification enabled. If an organization manages the network, use its approved configuration rather than applying an unrelated proxy workaround.

When handing the failure to a gateway operator, include a redacted request shape and the last event type received. A screenshot containing only “disconnected” discards the distinction the operator needs. Keep the original trace locally; share a reduced version that excludes authorization headers, private input and tool output.

stream disconnected before completion: idle timeout waiting for sse

An idle timeout means the wait for the next SSE event exceeded the configured interval. It is not the same as a response taking a long time overall: a long-running response that continues producing events has a different timing pattern from a silent stream.[1]

The configuration reference checked on October 22, 2026 separates three controls:[2]

Provider settingDocumented scope
stream_idle_timeout_msIdle wait for SSE events, measured in milliseconds
stream_max_retriesRetry count for SSE interruptions
request_max_retriesRetry count for HTTP requests

Increasing the idle interval changes how long the client waits. It cannot make an incompatible endpoint emit Responses events or restore bytes already lost. Raising retry counts changes the number of attempts rather than the cause of the first failure.

Measure before adjusting either value. Record when the response begins, when each event arrives and when the failure is reported. If the client timeout is the observed boundary, review it alongside the service's documented behavior. If the connection closes earlier, investigate that close instead. Do not assign a universal timeout to every model, network and gateway based on one failed turn.

rate limit exceeded: upstream rate limit exceeded, please retry later

This message reports a limit somewhere on the request path, but the wording alone does not identify the account, limiting dimension or reset time. Do not infer a particular supplier from “upstream,” or assume that buying more credits will repair every rate-limit response.

OpenAI's direct API documentation distinguishes request and token rate limits, temporary overload, and quota or spend conditions. It documents rate-limit response headers and says that Retry-After, when supplied for a temporary condition, provides a minimum wait. It also warns that account conditions requiring action are not fixed by retries.[4] Those are OpenAI's documented semantics; use the documentation and headers of the endpoint you actually call.

Evidence from the actual endpointAppropriate response
Temporary limit with a retry hintWait at least as long as the service specifies, then retry within a bounded policy
Request-rate exhaustionReduce the request rate across the workers sharing that limit
Token-rate exhaustionReview token demand as well as request count
Quota, billing or spend-cap conditionResolve the account condition before replaying the workload
Generic message without a limiting dimensionCollect the request ID and ask the service operator to identify the constraint

OpenAI recommends exponential backoff with randomness when an appropriate retry hint is absent, and notes that unsuccessful requests can contribute to rate limits. Account for SDK retries before adding another application retry loop.[4] A retry policy should have a stopping condition; it should not turn one rejected task into an unbounded stream of new requests.

For an agent task, also inspect what already happened. Read the working-tree diff and the tool history before asking the agent to repeat an interrupted operation. A failed final response is not evidence that every earlier tool action failed. That reconciliation step is operational advice for avoiding duplicate work, not a claim that Codex can roll back external actions automatically.

Why does my Codex stream disconnect before completion and the stream closed before the response is completed?

In the inspected SSE path, the client reached the end of the input without successfully returning completion and without a more specific saved error to return. Determine whether the terminal event was absent, invalid or lost along the path by comparing the received trace with the service's trace. The message alone cannot choose between those explanations.[1]

Why does Codex keep disconnecting?

Repeated failures need a repeatable comparison: keep the client version, model and endpoint fixed, capture the full error, and change one condition at a time. First distinguish early close, transport failure, idle timeout and a service rejection. Increasing retries before making that distinction can repeat the same failure without adding useful evidence.

codex request timed out

Determine which component reported the timeout. The Codex provider configuration exposes an SSE idle interval, while an API client can also report a request timeout. OpenAI's API guidance lists network and server-side factors to investigate for timeout errors; it does not make a timeout proof of one specific cause.[2][5]

resume stream unavailable

Do not read this as a guarantee that a response can be resumed, or as proof that all completed work was lost. Record the client version and full error, preserve the conversation and inspect completed tool actions. The sources reviewed for this article do not establish a universal recovery command for this exact string, so no such command is prescribed here.

If your next step is changing models or endpoints, the GPT-6 Astra migration guide explains how to separate model discovery, protocol changes and tool validation. The model page carries the current reAPI offering. Neither a model name nor a price listing substitutes for a successful end-to-end Codex compatibility check.

Sources checked October 22, 2026

  1. OpenAI. Codex Responses SSE implementation, revision c2d5ea52e1b7ab11ee2d71dc44ea1ef00f9c8eb3. Source and accompanying tests.
  2. OpenAI. Configuration Reference, provider protocol, timeout and retry settings. Configuration reference.
  3. reAPI. GPT-6 Astra request documentation. Published request contract; implementation documentation inspected locally, not a live generation test.
  4. OpenAI. Rate limits, response headers and retry guidance. API rate limits.
  5. OpenAI. Error codes, API connection and timeout errors. API error guidance.
All resources