Streaming stops partway

When a streamed answer stops in the middle, the connection broke after the reply had started. Because the response had already begun with a 200 OK, the API reports the problem as a final event in the stream instead of an error status. Retry the whole request; a stream cannot be resumed from the middle.

How to recognize it

The last event in the stream carries an error:

data: {"error":{"type":"api_error","code":"stream_error","message":"The response stream was interrupted. Retry the request.","param":null,"request_id":"req_…"}}

Then the stream closes.

What to do

  1. Retry the full request. A new request produces a new answer. Do not try to continue from where the text stopped.
  2. Treat partial text as a draft. Show it only if your app makes clear it is incomplete, or discard it.
  3. Check what is between you and the API. Proxies, load balancers and corporate networks sometimes close long-running connections. Make sure their idle timeout is long enough for streaming.
  4. Check the status page if it happens to many requests at once: status.syntic.ai.

If the answer just ends early without an error

That is not a broken stream. The model stopped on purpose, most often because it reached max_tokens. Check the finish reason in the last chunk, and raise max_tokens if you need longer answers. See Stop reasons.

In the apps

  • Web app and Syntic Desktop: send the message again. A long conversation may also need a fresh chat; Desktop says “This conversation is too long. Start a new chat or upgrade.” when that is the cause.
  • Syntic Code: connection drops are retried automatically, with a countdown such as “retrying in 4s · attempt 2/10”.
Was this page helpful?