Skip to content

[v6.0] fix: OpenAI-compatible chat SSE errors lose structured error fields - #17278

Merged
lgrammel merged 1 commit into
release-v6.0from
backport-v6.0/13506-1
Jul 15, 2026
Merged

[v6.0] fix: OpenAI-compatible chat SSE errors lose structured error fields#17278
lgrammel merged 1 commit into
release-v6.0from
backport-v6.0/13506-1

Conversation

@lgrammel

Copy link
Copy Markdown
Collaborator

Background

OpenAI-compatible SSE errors were exposed as message strings, discarding machine-readable codes needed for programmatic error handling.

Summary

The chat stream transformer now forwards the complete parsed SSE error object instead of only its message.

Testing

Updated the existing chat stream regression test and inline snapshot to verify that the error message and code are preserved.

End-to-end Validation

  • pnpm tsx --eval <synthetic SSE fullStream validation> — observed {"message":"Context length exceeded","code":"CONTEXT_LENGTH_EXCEEDED"}.
  • pnpm tsx --eval <live OpenAI-compatible streamText validation> — OpenAI returned OK. with finish reason stop.

Related Issues

Fixes #13506

Backport of #17230

Co-authored-by: StellaCheong59 178243329+StellaCheong59@users.noreply.github.com

…17230)

## Background

OpenAI-compatible SSE errors were exposed as message strings, discarding
machine-readable codes needed for programmatic error handling.

## Summary

The chat stream transformer now forwards the complete parsed SSE error
object instead of only its message.

## Testing

Updated the existing chat stream regression test and inline snapshot to
verify that the error message and code are preserved.

## End-to-end Validation

- `pnpm tsx --eval <synthetic SSE fullStream validation>` — observed
`{"message":"Context length
exceeded","code":"CONTEXT_LENGTH_EXCEEDED"}`.
- `pnpm tsx --eval <live OpenAI-compatible streamText validation>` —
OpenAI returned `OK.` with finish reason `stop`.

## Related Issues

Fixes #13506

Co-authored-by: StellaCheong59
<178243329+StellaCheong59@users.noreply.github.com>
@lgrammel
lgrammel merged commit 94fda5c into release-v6.0 Jul 15, 2026
47 of 49 checks passed
@lgrammel
lgrammel deleted the backport-v6.0/13506-1 branch July 15, 2026 08:41
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Published in:

Package Version
ai 6.0.227 github npm
@ai-sdk/alibaba 1.0.39 github npm
@ai-sdk/angular 2.0.228 github npm
@ai-sdk/baseten 1.0.64 github npm
@ai-sdk/cerebras 2.0.67 github npm
@ai-sdk/deepinfra 2.0.65 github npm
@ai-sdk/fireworks 2.0.69 github npm
@ai-sdk/google-vertex 4.0.162 github npm
@ai-sdk/huggingface 1.0.63 github npm
@ai-sdk/langchain 2.0.235 github npm
@ai-sdk/llamaindex 2.0.227 github npm
@ai-sdk/mistral 3.0.50 github npm
@ai-sdk/moonshotai 2.0.37 github npm
@ai-sdk/openai-compatible 2.0.61 github npm
@ai-sdk/react 3.0.229 github npm
@ai-sdk/rsc 2.0.227 github npm
@ai-sdk/svelte 4.0.227 github npm
@ai-sdk/togetherai 2.0.66 github npm
@ai-sdk/vercel 2.0.63 github npm
@ai-sdk/vue 3.0.227 github npm
@ai-sdk/xai 3.0.108 github npm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant