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
- Getting
Unhandled Rejectionevent, randomly. , mManishTrivedi, opened 2024-07-29; closed as completed on 2026-07-08: "A Node.js library is throwing an unhandled promise rejection error due to improper error handling." - docs: document assistant stream failures, HAYDEN-OAI; merged 2026-07-08 (closed).
- v6.46.0, published 2026-07-09.
- November 2026 helper documentation at v7.63.0.
- v7.63.0 release, published 2026-11-23.
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