Repository navigation
fix(core): read provider errors from plain AI SDK stream errors - #51194
Merged
Merged
Conversation
rekram1-node
force-pushed
the
aisdk-error-message
branch
from
September 24, 2026 18:37
867bb00 to
0a98fe0
Compare
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
N/A. Found while testing default output limits for #51021.
Type of change
What does this PR do?
Provider errors that the AI SDK streams as plain objects now keep their message and classification. Before, they showed up as "[object Object]" and were retried as unknown errors.
The Vercel AI Gateway streams upstream rejections as plain objects, not
Errorinstances. Two shapes came up live:{ "name": "AI_TypeValidationError", "cause": { ... }, "value": { "error": { "code": "invalid_parameter_error", "type": "invalid_request_error", "message": "<400> InternalError.Algo.InvalidParameter: Range of max_tokens should be [1, 32768]" } } } { "code": "invalid_request", "message": "Unable to submit request because This model does not support system instructions.." }unknownErrorMessagecalledString(error)on these, and the fallback always built anUnknownProviderError, which the runner retries.messageorerror.message, including undervalue. When there is none, it falls back to "Provider request failed".RequestExecutor.httpFailure, the same classifier as HTTP failures, using the object (or itsvalue) as the error data. The first shape carriesinvalid_request_error, which already classifies as an invalid request.invalid_request: added to the invalid-request codes. It is the gateway's code for an upstream rejection.How did you verify your code works?
Unit test: both gateway shapes keep their message and classify as invalid requests. The
packages/coreAI SDK suites and the fullpackages/aisuite pass.Live through the Vercel AI Gateway, with feat(core): fit output limits to the context window #51021 applied:
alibaba/qwen3-max-thinkingmaxgoogle/gemini-omni-flash-previewScreenshots / recordings
N/A
Checklist