fix: throw-error-when-docx-pptx-failed#920
Open
wyMinLwin wants to merge 2 commits intoanthropics:mainfrom
Open
fix: throw-error-when-docx-pptx-failed#920wyMinLwin wants to merge 2 commits intoanthropics:mainfrom
wyMinLwin wants to merge 2 commits intoanthropics:mainfrom
Conversation
Contributor
felixfbecker
left a comment
There was a problem hiding this comment.
thank you ❤️
I've ran into these errors too and I think this will make them much easier to debug.
Do we need to this for our other SDK languages too?
src/lib/BetaMessageStream.ts
Outdated
| // a server-side error that caused the stream to close prematurely. | ||
| if (snapshot.stop_reason == null) { | ||
| throw new AnthropicError( | ||
| 'stream ended without receiving a terminal event; the response may be incomplete due to a server-side error', |
Contributor
There was a problem hiding this comment.
nit: capitalize error message
Author
|
I might not sure other SDK would need it but I can give a look and I capitalized error message |
felixfbecker
approved these changes
Feb 21, 2026
Contributor
felixfbecker
left a comment
There was a problem hiding this comment.
I'll let Stainless review too
Author
|
@felixfbecker I am reminding for this PR incase you forget to let Stainless review |
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.
I fixed an issue where the server would silently fail if it closed the SSE stream without sending message_stop.Now in endRequest() for both MessageStream and BetaMessageStream, I added a stop_reason null check. If stop_reason is missing, it throws a clear, descriptive error instead of resolving with an incomplete message.
for #893