# Agents SDK -\> TypeError: terminated

**URL:** <https://community.openai.com/t/agents-sdk-typeerror-terminated/1371661>\
**Category:** Bugs\
**Tags:** api, gpt-5, agents-sdk, gpt-41\
**Created:** [January 14, 2026, 11:00am UTC](https://community.openai.com/t/agents-sdk-typeerror-terminated/1371661 "2026-01-14T11:00:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![baki.kucukcakiroglu](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/baki.kucukcakiroglu/32/618324_2.png) [@baki.kucukcakiroglu](https://community.openai.com/u/baki.kucukcakiroglu)\
**Post date:** [January 14, 2026, 11:00am UTC](https://community.openai.com/t/agents-sdk-typeerror-terminated/1371661/1 "2026-01-14T11:00:39Z")

</div>

We use `openai-agents-js` (default **Responses API** ) to run our Multi-Agent Systems (MAS). During MAS runs, we intermittently hit the following error:

```json
{
  "error": "TypeError: terminated"
}

```

We’ve seen this issue for a long time, but the frequency has **increased significantly over the last 2 days**. It happens in **both streamed and non-streamed** MAS runs.

We use the **`gpt-4.1`** and **`gpt-5`** model families across our MASes.

Full error (from our logs):

```txt
"message": "terminated",
2026-01-14 10:07:06.941 CET
"stack": "TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:11322:53)
    at Fetch.emit (node:events:524:28)
    at Fetch.terminate (node:internal/deps/undici/undici:10480:14)
    at Object.onError (node:internal/deps/undici/undici:11443:38)
    at Request.onError (node:internal/deps/undici/undici:2210:31)
    at Object.errorRequest (node:internal/deps/undici/undici:1707:17)
    at TLSSocket.<anonymous> (node:internal/deps/undici/undici:6433:16)
    at TLSSocket.emit (node:events:536:35)
    at node:net:343:12
    at TCP.done (node:_tls_wrap:648:7)"

```

Because the SDK uses the Responses API by default, this may be related to the following thread:

> [@200 OK from /v1/responses but body times out (UND\_ERR\_BODY\_TIMEOUT)](https://community.openai.com/t/200-ok-from-v1-responses-but-body-times-out-und-err-body-timeout/1371083):
>
> I’m seeing a frequent failure when calling the Responses API that looks like a client-side body timeout even though the API returns 200 OK. Stack Node.js (v22, using built-in fetch and undici) ai@6.0.7 @ai-sdk/openai@3.0.2 @ai-sdk/provider-utils@4.0.2 Model: gpt-5.2-2025-12-11 What happens OpenAI responds with 200 OK Headers arrive successfully While reading the response body, undici aborts with BodyTimeoutError (UND\_ERR\_BODY\_TIMEOUT) The AI SDK then throws Failed …

This issue may also be related:

> <https://github.com/openai/openai-agents-js/issues/744>
>
> \## Problem
> 
> Since late November 2025, transient network errors during LLM stre…aming responses cause agent runs to crash. This was not an issue before.
> 
> Two common error types:
> 
> 1. \*\*Socket closed\*\* (\`UND\_ERR\_SOCKET\`):
> \`\`\`
> TypeError: terminated
> \[cause\]: SocketError: other side closed
> code: 'UND\_ERR\_SOCKET'
> \`\`\`
> 
> 2. \*\*Body timeout\*\* (\`UND\_ERR\_BODY\_TIMEOUT\`):
> \`\`\`
> TypeError: terminated
> \[cause\]: BodyTimeoutError: Body Timeout Error
> code: 'UND\_ERR\_BODY\_TIMEOUT'
> \`\`\`
> 
> ### Why existing options don't help
> 
> The \`maxRetries\` option on the OpenAI client only applies to connection-level retries before a request starts, not mid-stream failures.

And this is the corresponding “twin” issue in the `openai-agents-js` repository:

> <https://github.com/openai/openai-agents-js/issues/855>
>
> While running a Multi-Agent System (MAS), we intermittently hit the following er…ror:
> 
> \`\`\`json
> {
> "error": "TypeError: terminated"
> }
> \`\`\`
> 
> We’ve been seeing this for a long time, but the frequency has \*\*increased significantly over the last 2 days\*\*. Both streamed and non-streamed MAS runs get the error. 
> 
> We use \*\*\`gpt-4.1\`\*\* and \*\*\`gpt-5\`\*\* model families in our MASes. 
> 
> Full error (from our logs):
> 
> \`\`\`txt
> "message": "terminated",
> 2026-01-14 10:07:06.941 CET
> "stack": "TypeError: terminated
> at Fetch.onAborted (node:internal/deps/undici/undici:11322:53)
> at Fetch.emit (node:events:524:28)
> at Fetch.terminate (node:internal/deps/undici/undici:10480:14)
> at Object.onError (node:internal/deps/undici/undici:11443:38)
> at Request.onError (node:internal/deps/undici/undici:2210:31)
> at Object.errorRequest (node:internal/deps/undici/undici:1707:17)
> at TLSSocket.\<anonymous\> (node:internal/deps/undici/undici:6433:16)
> at TLSSocket.emit (node:events:536:35)
> at node:net:343:12
> at TCP.done (node:\_tls\_wrap:648:7)"
> \`\`\`
> 
> Example Trace 1: \<img width="1294" height="552" alt="Image" src="https://github.com/user-attachments/assets/61d682c4-525d-416f-9500-a17dc096cf88" /\>
> 
> Example Trace 2: \<img width="1295" height="579" alt="Image" src="https://github.com/user-attachments/assets/e38f7ddd-81e5-4a0f-8820-068125199db5" /\>
> 
> If there are any known incidents, rate limits, networking changes, or recommended client settings for these model families that could explain the recent increase, we’d appreciate any guidance. We’d also like to understand whether this error is caused by our system or if it’s originating from the OpenAI backend.

If there are any known incidents, rate limits, networking changes, or recommended client settings for these model families that could explain the recent increase, we’d appreciate any guidance. We’d also like to understand whether this error is caused by our system (e.g., timeouts/aborts/network/proxy behavior) or if it’s originating from the OpenAI backend.

---

<div class="post-metadata">

**Author:** ![OpenAI\_Support](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/openai_support/32/561845_2.png) [@OpenAI\_Support](https://community.openai.com/u/OpenAI_Support)\
**Post date:** [February 16, 2026, 4:59pm UTC](https://community.openai.com/t/agents-sdk-typeerror-terminated/1371661/3 "2026-02-16T16:59:29Z")

</div>

Hey Baki, Would you be able to open a support request with us at support@openai.com. We are asking you since we will require some more details. We want you to make sure that you add your forum username and forum link into the support request and share the case id or case subject here with us so we can track it.

- We want you to please provide your request id (here and in the ticket). 
- In Node/undici, “terminated” often wraps a more specific cause like: `UND_ERR_SOCKET` (other side closed) OR `UND_ERR_BODY_TIMEOUT` (body timeout). Can you please provide that full error stack. **(IN THE TICKET)**
- Can you also enable SDK debug logging and share the snippet around a failure. [This guide here](https://openai.github.io/openai-agents-js/guides/troubleshooting/?utm_source=chatgpt.com) will help. **(IN THE TICKET).**

Once we have these information, we can debug this further. Thank you!

---

<div class="post-metadata">

**Author:** ![Prashant\_Pardesi](https://avatars.discourse-cdn.com/v4/letter/p/f9ae1b/32.png) [@Prashant\_Pardesi](https://community.openai.com/u/Prashant_Pardesi)\
**Post date:** [February 21, 2026, 3:13pm UTC](https://community.openai.com/t/agents-sdk-typeerror-terminated/1371661/4 "2026-02-21T15:13:28Z")

</div>

Closed on February 21, 2026, 3:13pm UTC


