GitHub Repo
langchain-openai 1.6.6 fixes silent streaming errors, raises exceptions for failure events
The release propagates explicit failure events in Responses API streams to the application layer, with tests added for both synchronous and asynchronous interfaces. Truncated streams without terminal events still require separate verification, and existing exception handling and retry strategies need review.

LangChain released langchain-openai 1.6.6 on September 24, fixing an issue where Responses API streams did not raise exceptions upon receiving failure events. The GitHub release record and PyPI publication date match, confirming that the fix is available in the official package release. Agents that use streamed answers to drive subsequent tasks can now identify generation failures more clearly. [Release notes](https://github.com/langchain-ai/langchain/releases/tag/langchain-openai==1.6.6), [PyPI package](https://pypi.org/project/langchain-openai/1.6.6/)
The issue originated in the event conversion layer. A user report from July reproduced it using a mock HTTP transport: the server first sent partial text, then a failure event, yet the old version could still finish iteration normally, without raising an exception or preserving error information. If an application treated the end of the loop as success, a truncated answer could be saved or passed to the next step. [Original report](https://github.com/langchain-ai/langchain/issues/39039)
The updated code reads error data from the response when it receives `response.failed` and combines the error code and message when it receives `error`. Both cases raise a `ValueError`. If a failed response contains no error details, the code constructs a message using the response ID. This allows the application layer to catch failures, but existing handlers that catch only provider SDK-specific exceptions will still need adjustment. [Patch diff](https://github.com/langchain-ai/langchain/pull/40791/files)
Applications must also handle text already displayed or written to a buffer. Based on this code change, raising an exception will not automatically retract previously emitted chunks. If downstream components parse the content into tool arguments, they should confirm that the response has completed before deciding whether to commit an operation. Error messages can aid diagnosis, but whether to retry and how long to back off remain separate policy decisions.
The patch also adds tests for synchronous `stream()` and asynchronous `astream()`, covering server errors, missing error details, and rate limit events. These tests use mock streams to verify event propagation; they do not establish the full behavior under real network conditions, proxy servers, or service outages. [Test code](https://github.com/langchain-ai/langchain/pull/40791/files)
The fix also has limits: the new branches handle explicit failure events, while `response.incomplete` still follows the existing code path. The original report also described streams with no terminal event at all. The diff does not establish that this type of truncation has been addressed. [Issue and reproduction cases](https://github.com/langchain-ai/langchain/issues/39039)
After upgrading, engineering teams should test a failure that occurs after text has already been emitted to verify interface state, traces, and retry strategies, while retaining completion status checks. This deployment recommendation follows from the patch’s behavior: exceptions make failures visible, but applications must still decide how to mark partial answers and how to avoid repeating completed work when retrying.