An API error: stream idle timeout – partial response received usually means the request started correctly, some data came back, then the stream stopped sending new data for too long. The connection may have been closed by the API, your client, a proxy, a gateway, or something in between.
This can be confusing because the API did not completely fail. You already received part of the answer. The problem happened later while the response was still streaming. The fixes below start with simple checks, then move into timeout settings, networks, proxies, and backend issues.
What Does “Stream Idle Timeout – Partial Response Received” Mean?

A stream idle timeout happens when an API connection stays open but no new response data arrives within the allowed time. Since some chunks were already received, the client reports a partial response instead of a complete failure. This is different from a connection timeout, where the request may fail before a response starts at all. It can also differ from a total request timeout, which may stop a request simply because it ran too long overall.
A simple way to think about it is this: the stream starts, data arrives, then there is a long quiet period. If that quiet period crosses a timeout limit, one layer in the request path may close the connection.
Why Does the API Stream Idle Timeout Happen?
The same error can come from several places, so there is no single cause. Sometimes the API provider is slow for a short period. Other times the client is configured with a read timeout that is too low, or a reverse proxy closes the connection before the API finishes working.
Common causes include:
- Temporary API slowdown or service issue
- Client read or stream timeout
- Large prompts, payloads, or requested output
- Slow backend processing
- VPN or proxy connection problems
- Reverse proxy or API gateway timeout
- Response buffering
- Slow database queries or external API calls
- High server load
- Worker or connection limits
- An old SDK or HTTP client with poor stream handling
Cache and storage can matter in some self-hosted apps or browser-based tools, but they are not common causes for a normal hosted API request. It is better to test the stream path first instead of clearing random data and hoping it works.
How to Fix API Error: Stream Idle Timeout – Partial Response Received?
Start with the easy checks first. After each change, repeat the same request if possible. This helps you see what really fixed the issue instead of changing five settings at once and losing track.
1. Retry the Request and Check the API Service Status
Try the same request once more. A stream can fail because of a short server delay, temporary network issue, or overloaded API service. If the second request works normally, the first failure may have been temporary.
Do not keep retrying the request again and again without limits. If it fails in the same way more than once, check the provider’s service status if one is available. Repeated failures usually mean you should move on to the next checks instead of relying on retries.
2. Test the Same Request Without Streaming
One of the fastest ways to narrow down the problem is to send the same request without streaming, if the API supports that option. Keep the prompt, payload, model, and other main settings as close as possible to the failing request.
The result tells you a lot:
- If the non-streaming request works, focus on stream handling, buffering, read timeout, proxy settings, or gateway limits.
- If both streaming and non-streaming requests fail, the issue may be related to request size, backend processing, network problems, or the API service itself.
This test is useful because it separates a general API problem from a streaming-only problem. You do not need to guess as much after that.
3. Reduce the Request Size or Requested Output
Large requests can take longer to process. A big prompt, large attachment, long context, or very large requested output may create longer pauses between response chunks. Those pauses can expose an idle timeout that does not appear with smaller requests.
Try sending a smaller version of the same task. Shorten the input, reduce the requested output, or remove extra attachments for the test. If the smaller request works while the full one fails, you have a useful clue.
This does not mean every large request will time out. It means larger work can increase processing time, and that can make an existing timeout setting more likely to cause trouble.
4. Increase the Client Read or Stream Timeout
Your API server may still be working while the local client has already decided it waited too long. This happens when an SDK, HTTP library, or application has a read timeout that is shorter than the time needed between stream chunks.
Check the timeout settings used by your client. Be careful here because a connection timeout is not always the same as a read timeout.
A practical order is:
- Find which SDK or HTTP library is making the API request.
- Check the current timeout settings used for streamed responses.
- Look for a read timeout, stream timeout, or similar setting.
- Increase the relevant value by a reasonable amount.
- Run the same request again and compare the result.
Do not copy a random timeout value from another library. Different clients use different settings and defaults. Also, a longer timeout will not fix a backend that has truly stopped working, so treat this as a test, not a magic fix.
5. Update the API SDK or HTTP Client
An old SDK can cause trouble with streaming, connection reuse, timeout handling, or retry behavior. If your project has not been updated for a while, check the version of the API SDK and the HTTP client underneath it.
Before updating production code, read the version notes and check for breaking changes. Newer does not always mean the timeout disappears, but updating can remove bugs that were already fixed in later releases. If the issue started after an upgrade, the opposite test can help too – compare the behavior with the last working version.
6. Disable the VPN or Proxy and Test Another Network
Streaming requests stay open longer than normal web requests. Because of that, a VPN, proxy, firewall, or unstable connection can cause problems even when normal browsing looks fine.
Try the request without an optional VPN or proxy. If you are on Wi-Fi, test another stable connection if one is available. You can also compare the same API call from another device or server.
Corporate networks can be different. A company firewall or proxy may have its own idle timeout rules. If you are on a managed network, do not bypass required security controls. Ask the network administrator to check whether long-lived HTTP or SSE connections are being closed.
7. Check Reverse Proxy, CDN, Load Balancer, and Gateway Timeouts
This is where it gets tricky. Your API request may pass through several layers before it reaches the main application. A common path looks like this:
Client → CDN or proxy → load balancer → application → API or backend
Any one of those layers can have its own timeout. Your application may allow a request to run for several minutes, but a proxy in front of it might close idle connections much earlier.
Check settings related to:
- Idle timeout
- Upstream read timeout
- Maximum request duration
- Keep-alive behavior
- Gateway request limits
- Long-lived connection support
If you change only the application’s timeout and nothing changes, another layer may still be closing the connection first. This is common in self-hosted setups where Nginx, a cloud gateway, or a load balancer sits in front of the API.
Be careful with platform-specific settings. The names and allowed values are not the same everywhere, so use the documentation for your exact proxy or gateway instead of copying settings from a different service.
8. Check Response Buffering
Sometimes the backend is sending data, but an intermediary waits before forwarding it to the client. That can make the stream look idle even though the server is still doing work.
A common sign is that response chunks arrive in large groups instead of appearing steadily. You may also notice that the direct backend stream works fine, while the same request through a reverse proxy stalls or arrives late.
Things worth checking include:
- Whether proxy buffering is enabled
- Whether streamed responses are flushed as they are produced
- Whether SSE or chunked responses are supported correctly
- Whether a CDN or gateway waits for a larger buffer before forwarding data
If possible, compare the stream by calling the backend directly in a safe test environment. If direct streaming works and the proxied route fails, the problem is probably somewhere in that middle layer.
9. Check Slow Backend Tasks, Tool Calls, or External APIs
The API stream may be waiting on work that happens behind the scenes. This can be a slow database query, another API request, a tool call, a model step, or a queued worker job. During that wait, the client may see no new stream data.
For example, your endpoint may start streaming normally, then call another service halfway through the request. If that service takes too long to answer, the stream can sit quiet. The client or proxy may then hit its idle timeout.
Measure how long each backend step takes. Check database timing, external API timing, worker logs, and any long-running tasks. This usually gives a clearer answer than looking only at the total request time.
If your app controls the stream protocol, it may be possible to send progress events while slow work is happening. That depends on the application design though, so it is not always an option.
10. Check Server CPU, Memory, Storage, and Worker Limits
This fix mostly applies to self-hosted APIs, local AI servers, custom gateways, and apps that sit between the user and another API. A hosted API user normally cannot check these server details.
Start by looking at system health around the time of the failure. High CPU use can slow response generation. Low memory can cause workers to crash or restart, and full storage can break temporary files or logs in some applications.
Check for:
- CPU staying near full use
- Memory exhaustion or process restarts
- Very low free disk space
- Worker crashes
- Connection pool limits
- Too many requests running at the same time
Concurrency is easy to miss. One request may work perfectly by itself, then fail when many users connect at once. If that happens, worker limits or connection pools may be part of the problem.
11. Add Safe Retry and Partial-Response Recovery Logic
Some streaming failures will still happen from time to time, even after the main setup is correct. Your application should handle that without turning one interrupted response into a complete failure.
Use controlled retry logic instead of an endless retry loop. A short delay between retries can help, and the delay can grow after each failed attempt. Keep a maximum retry count so the app does not keep sending the same request forever.
Be careful with requests that change data. Retrying a read-only request is usually simpler than retrying something that creates, sends, charges, or updates data. A repeated request could perform the same action twice if the API does not protect against duplicates.
If your app already received useful partial output, think about whether it should be saved. Throwing it away every time may not be necessary. Some APIs also support continuation or resume-style behavior, but that depends on the provider and endpoint.
How to Tell Whether the Problem Is Client-Side or Server-Side?
After trying the main fixes, the next question is usually simple: where is the failure happening? Comparing behavior across clients, networks, and servers can narrow it down.
| What You Notice | More Likely Area |
|---|---|
| Only one app or device fails | Client or local configuration |
| Another SDK works with the same request | SDK or HTTP client |
| The request works on another network | VPN, proxy, firewall, or ISP path |
| Several users fail at the same time | Server, provider, or shared infrastructure |
| Failure happens at nearly the same time every run | Proxy, gateway, or fixed timeout limit |
| Direct backend works but proxied traffic fails | Reverse proxy, CDN, or load balancer |
| Both streaming and non-streaming requests fail | General API, backend, or network issue |
There can be a middle ground too. A reverse proxy or gateway sits between the client and server, so it may look like a server issue even when the main API is healthy. That is why testing different paths is so useful.
How to Diagnose Where the Stream Stops
When the error keeps coming back, logs can tell you more than repeated guessing. You want to know when the request started, when the first chunk arrived, and when the last chunk appeared before the timeout.
Record these points if your application allows it:
- Request start time
- Time the connection was established
- Time the first response chunk arrived
- Time the last successful chunk arrived
- Time the timeout happened
- Request ID or trace ID
Now compare those times across several failed requests. If the stream always stops after roughly the same idle period, a fixed timeout setting may be involved. If the delay changes a lot, backend load, external services, or network quality may be more likely.
For self-hosted systems, compare client logs with proxy and backend logs. Try to match them using the request ID. Before sharing logs with anyone, remove API keys, authorization headers, private prompts, access tokens, and other sensitive data.
When Should You Contact the API Provider or Hosting Provider?
Contact the API provider or hosting company when the issue keeps happening after controlled tests, especially if different devices and networks show the same failure. You should also reach out when the provider’s side appears to stop sending data, or when you cannot access the server logs needed to find the cause.
Send useful details instead of just saying the API timed out. Include:
- The exact error message
- Date and time of the failure
- Your timezone
- Request ID if available
- API endpoint or feature being used
- SDK and client version
- Whether non-streaming works
- Whether another network shows the same problem
- Roughly when the stream stops
Do not send API keys, passwords, authorization headers, or other secret values. Support normally does not need them to trace a request.
How Can You Prevent API Stream Idle Timeout Errors?
Once the error is fixed, it is worth checking the whole request path so the same problem does not return later. The client, proxy, gateway, and backend should all have timeout settings that make sense together. If one layer is much shorter than the others, that layer can still end the stream early.
A few habits help:
- Keep API SDKs and HTTP libraries up to date
- Set sensible read and stream timeouts
- Keep gateway and proxy timeout limits aligned
- Avoid sending more input or output than the task needs
- Watch the time between response chunks
- Add controlled retry handling
- Track slow database and external API calls
- Save request IDs and timing data for failed requests
- Monitor server load if you run the backend yourself
The main point is not to make every timeout huge. That can hide slow or stuck requests. Better timing data and a clear request path usually make these errors much easier to fix.
Final Thoughts
The stream idle timeout – partial response received error means the request made some progress, then the response stream stayed quiet or was closed before completion. Start simple: retry once, test without streaming, reduce the request size, and check the client’s read timeout. If that does not solve it, move outward to the network, proxy, gateway, and backend.
The most useful clue is often where the stream stops. If the failure happens at the same time every run, check fixed timeout limits. If it happens randomly, look harder at network quality, backend load, and slow dependencies. If you’re still stuck, comment with whether your request fails only in streaming mode or also in non-streaming mode.