Repository navigation
Description
Describe the bug
Title
Responses API streaming error event has nested structure not matching documentation
Description
The streaming error event from the Responses API returns a nested JSON structure that differs from the documented format, causing SDK deserialization to fail.
Documented Format
Per the API reference at:
https://platform.openai.com/docs/api-reference/responses-streaming/error
{
"type": "error",
"code": "ERR_SOMETHING",
"message": "Something went wrong",
"param": null,
"sequence_number": 1
}Actual Format Received
{
"type": "error",
"sequence_number": 2,
"error": {
"type": "too_many_requests",
"code": "too_many_requests",
"message": "Too Many Requests",
"param": null
}
}Problem
The SDK deserializer in StreamingResponseErrorUpdate.Serialization.cs expects code, message, and param at the root level. With the nested error object, these properties are not found and remain null.
Impact
StreamingResponseErrorUpdate.CodeisnullStreamingResponseErrorUpdate.MessageisnullStreamingResponseErrorUpdate.Paramisnull- Error details are inaccessible to applications
Steps to Reproduce
- Call Responses API with
stream: true - Trigger a rate limit (429) error
- Observe the streamed error event format
Suggested Fix
Update the API to return the documented flat structure, or update documentation to reflect the nested error object format.
OS
All (We hit on Windows and Linux)
.NET version
All (We hit on .NET 9)
Library version
All (We hit on 2.5.0)
Activity
ShivangiReja commentedon Dec 20, 2025
Hi @TheGrayFrost, thanks for reaching out. I tried reproducing this and you’re right. The API documentation and the REST API spec currently describes the error event in this flat format:
{ "type": "error", "code": "ERR_SOMETHING", "message": "Something went wrong", "param": "input", "sequence_number": 1 }However, the service is returning a nested format like this:
{ "type": "error", "sequence_number": 2, "error": { "type": "invalid_request_error", "code": "context_length_exceeded", "message": "Your input exceeds the context window of this model. Please adjust your input and try again.", "param": "input" } }Because
StreamingResponseErrorUpdate.Serialization.csexpectscode,message, andparamat the root level, deserialization fails and these properties remain null.In this case, it appears that the OpenAI service is not honoring its public contract and is intermittently returning an incorrect error response. This behavior is on the service-side, the client library has no insight nor influence over it. Unfortunately, OpenAI does not offer service support from this repository. The most reliable and direct way to get support is by reaching out to the OpenAI Support Team. You can either email [email protected] or start a new chat session via the Help Center. The OpenAI support team is available 24/7 and is equipped to assist with the full range of requests.
In the meantime, you can access the fields via the
Patchproperty.Example:
stephentoub commentedon Dec 20, 2025
#849
#528
Restore the keepalive off switch and stop replaying permanent errors