Skip to content

Fix NPE in AnthropicApi StreamHelper #3755

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

ilayaperumalg
Copy link
Member

  • When the error event occurs, the ChatCompletionResponseBuilder is empty and hence the contentBlockReference.get() throws NPE.
    • Add null check to unhandled event in addition to the logging the event type
    • Add test to verify the usecase

Resolves #3740

 - When the error event occurs, the ChatCompletionResponseBuilder is empty and hence the contentBlockReference.get() throws NPE.
   - Add null check to unhandled event in addition to the logging the event type
   - Add test to verify the usecase

Resolves spring-projects#3740

Signed-off-by: Ilayaperumal Gopinathan <[email protected]>
@ilayaperumalg ilayaperumalg added this to the 1.1.x milestone Jul 7, 2025
@sobychacko sobychacko merged commit 283d0c6 into spring-projects:main Jul 7, 2025
2 checks passed
spring-builds pushed a commit that referenced this pull request Jul 7, 2025
- When the error event occurs, the ChatCompletionResponseBuilder is empty and hence the contentBlockReference.get() throws NPE.
   - Add null check to unhandled event in addition to the logging the event type
   - Add test to verify the usecase

Fixes #3740

Signed-off-by: Ilayaperumal Gopinathan <[email protected]>
(cherry picked from commit 283d0c6)
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.

Anthropic Error Responses Can Cause NPE In StreamHelper
2 participants