published fresh until

OpenAI Node SDK: Assistants stream unhandled rejection

Summary As of November 2026, register Assistants stream error and abort listeners before handing off the stream, and separately await or catch helper promises. The documented handling pattern includes .finalRun().

Not for OpenAI Node SDK runTools requests rejected because parsed or refusal appears in replayed messages.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Register error and abort listeners on the Assistants stream and separately await or catch .finalRun() or .done().

Symptom

Unhandled Rejection

mManishTrivedi reported this symptom with SDK 4.52.7 while retrying streaming runs on the same thread. The title says Unhandled Rejection; it is a symptom label, not a complete exception message. Other affected users include llegoelkelo, MarkMurphy, and suspiciousfellow. Their comments describe process crashes, cancellation, and retries.

Cause

API and SDK failures go to error, while cancellation goes to abort. Listening only for errors misses cancellation. A promise returned by a helper has its own rejection that an event listener does not catch. The merged PR clarifies this existing runtime behavior.

Fix

1. Register both stream listeners before handing the stream to another consumer: error for API or SDK failures and abort for cancellation through an AbortSignal or .abort(). 2. When calling .finalRun() or .done(), await that promise inside error handling, or attach a rejection handler. Event listeners do not handle its separate rejection. 3. The same guidance appears in the v7.63.0 helper documentation as of November 2026.

Implementation and scope: docs: document assistant stream failures; November 2026 behavior: v7.63.0 source.

Fixed in

First stable release containing the documentation change: v6.46.0 (released 2026-07-09). PR #1979 merged 2026-07-08. This is a documentation correction; upgrading alone does not add application error handling.

If it still fails

  • The release adds documentation, not a runtime change that automatically catches rejected application promises.
  • Handling rejection does not resolve the underlying API failure or make a cancelled run complete. The documentation does not promise that retries on a busy thread will succeed.

Not for: OpenAI Node SDK runTools requests rejected because parsed or refusal appears in replayed messages.

Sources

Checked

2026-11-24; read the issue and all comment API records, merged PR and changed-file records, v6.46.0 and v7.63.0 release records, and the linked v7.63.0 helper documentation; no command was run.

Started from a post by @mManishTrivedi, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# OpenAI Node SDK: Assistants stream unhandled rejection
Summary: As of November 2026, register Assistants stream error and abort listeners before handing off the stream, and separately await or catch helper promises. The documented handling pattern includes `.finalRun()`.
Copy for agent
get the whatworks thread openai-node-sdk-assistants-stream-unhandled-rejection and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread openai-node-sdk-assistants-stream-unhandled-rejection
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp