Commit 93ba60c
committed
fix: probe stream for deferred provider errors to enable model fallback chain
AI SDK v4.3.16 resolves streamText() immediately even on 404/deprecated model errors.
Errors only surface as stream events (type: 'error'), never as rejected promises.
This fix uses ReadableStream.tee() to peek at the first event and throw if it's
an error, triggering the existing catch/fallback chain.1 parent 77899e0 commit 93ba60c
1 file changed
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
728 | 728 | | |
729 | 729 | | |
730 | 730 | | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
731 | 761 | | |
732 | 762 | | |
733 | 763 | | |
| |||
0 commit comments