-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: surface actual API error messages instead of generic NoOutputGeneratedError #11359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Contributor
Reviewed commit ecd3c07. The indentation fix in minimax.ts is correct and all previously flagged issues are now resolved.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
…eratedError - Add consumeAiSdkStream() shared utility that captures stream error messages and substitutes them when result.usage throws NoOutputGeneratedError - Update all 17 AI SDK providers to use the new utility - Add extractMessageFromResponseBody() for JSON error response parsing - Enhance extractAiSdkErrorMessage() with responseBody extraction - Fix duplicate error display on mid-stream failures with auto-retry - Add 18 new tests covering error extraction and stream consumption
ffd4870 to
739f64a
Compare
daniel-lxs
approved these changes
Feb 10, 2026
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.
Summary
When AI SDK providers return HTTP errors (e.g., Z.ai "Insufficient balance" or "token expired"), users saw the useless generic message "No output generated. Check the stream for errors." instead of the actual API error. This PR fixes error message extraction across all 17 AI SDK providers and eliminates duplicate error display on mid-stream failures.
Root Cause
The AI SDK's
streamText()has a dual error path: the actual API error appears in the stream as an error chunk (with the correct message), but thenresult.usagethrows a separateNoOutputGeneratedErrorwith a generic message and no reference to the original error. The generic error was overwriting the real one.Changes
Core utility (
src/api/transform/ai-sdk.ts)consumeAiSdkStream()— shared utility that captures stream error messages during iteration and substitutes them whenresult.usagethrowsNoOutputGeneratedErrorextractMessageFromResponseBody()— parses JSON error responses from API response bodiesextractAiSdkErrorMessage()withresponseBodyextraction forAI_APICallError,AI_RetryError, andAI_NoOutputGeneratedError17 AI SDK providers updated
consumeAiSdkStream()directly with optionalusageHandler— zai, xai, fireworks, sambanova, deepseek, mistral, baseten, lm-studio, azure, requesty, openai-compatible, openai-nativelastStreamErrorcapture preserving custom stream logic (thinking signatures, grounding, throttle handling) — anthropic, anthropic-vertex, vertex, gemini, bedrockDuplicate error display fix (
src/core/task/Task.ts)abortStream()no longer displays the error message (sincebackoffAndAnnounce()will display it with the retry countdown). This eliminates the duplicate "API Request Failed" + "Provider Error" display.Tests
ai-sdk.spec.tscoveringconsumeAiSdkStream,extractMessageFromResponseBody, and enhanced error extractionBefore → After
Important
This PR replaces generic error messages with specific API error messages across 17 AI SDK providers, adds a new utility for error handling, and fixes duplicate error messages during mid-stream failures.
NoOutputGeneratedErrorwith specific API error messages across 17 AI SDK providers.Task.ts.consumeAiSdkStream()inai-sdk.tsto capture stream error messages and handleNoOutputGeneratedError.extractMessageFromResponseBody()to parse JSON error responses.consumeAiSdkStream()directly: zai, xai, fireworks, sambanova, deepseek, mistral, baseten, lm-studio, azure, requesty, openai-compatible, openai-native.ai-sdk.spec.tsforconsumeAiSdkStream,extractMessageFromResponseBody, and enhanced error extraction.This description was created by
for ecd3c07. You can customize this summary. It will automatically update as commits are pushed.