Responses, Bug: error event shape is wrong between documentation and SDKs and reality

What it says

What it depicts


{
  "type": "error",
  "code": "ERR_SOMETHING",
  "message": "Something went wrong",
  "param": null,
  "sequence_number": 1
}

What is actually received

event: error
data: {"type":"error","sequence_number":2,"error":{"type":"invalid_request_error","code":null,"message":"There was an issue with your request. Please check your inputs and try again","param":null}}

Or pretty:

{
  "type": "error",
  "sequence_number": 2,
  "error": {
    "type": "invalid_request_error",
    "code": null,
    "message": "There was an issue with your request. Please check your inputs and try again",
    "param": null
  }
}

The issue

typeError - you guys are sending an object as “error”, not a string, and its format doesn’t match the docs either.

The SDK is also going to crash and burn.

Thanks, OpenAI lurkers!

The blob storage yaml spec updated in the SDK yesterday: Still says “message” == string, and has "code" "message", "parameter" as required which is not being delivered at the root.

    ResponseErrorEvent:
      type: object
      description: Emitted when an error occurs.
      properties:
        type:
          type: string
          description: |
            The type of the event. Always `error`.
          enum:
            - error
          x-stainless-const: true
        code:
          anyOf:
            - type: string
              description: |
                The error code.
            - type: 'null'
        message:
          type: string
          description: |
            The error message.
        param:
          anyOf:
            - type: string
              description: |
                The error parameter.
            - type: 'null'
        sequence_number:
          type: integer
          description: The sequence number of this event.
      required:
        - type
        - code
        - message
        - param
        - sequence_number
      x-oaiMeta:
        name: error
        group: responses
        example: |
          {
            "type": "error",
            "code": "ERR_SOMETHING",
            "message": "Something went wrong",
            "param": null,
            "sequence_number": 1
          }