You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug description
NullPointerException happens during anthropic streaming
Aggregation Error
java.lang.NullPointerException: Cannot invoke "org.springframework.ai.anthropic.api.StreamHelper$ChatCompletionResponseBuilder.withType(String)" because the return value of "java.util.concurrent.atomic.AtomicReference.get()" is null
Steps to reproduce
Unfortunately, it happens sometimes, probably it depends on the streaming response chain.
Prerequisites: Anthropic streaming call
org.springframework.ai.chat.model.MessageAggregator:170 lambda$aggregate$6 - Aggregation Error
java.lang.NullPointerException: Cannot invoke "org.springframework.ai.anthropic.api.StreamHelper$ChatCompletionResponseBuilder.withType(String)" because the return value of "java.util.concurrent.atomic.AtomicReference.get()" is null
at org.springframework.ai.anthropic.api.StreamHelper.eventToChatCompletionResponse(StreamHelper.java:185)
at org.springframework.ai.anthropic.api.AnthropicApi.lambda$chatCompletionStream$9(AnthropicApi.java:217)
at reactor.core.publisher.FluxMap$MapConditionalSubscriber.onNext(FluxMap.java:208)
at reactor.core.publisher.FluxFlatMap$FlatMapMain.tryEmit(FluxFlatMap.java:547)
at reactor.core.publisher.FluxFlatMap$FlatMapInner.onNext(FluxFlatMap.java:988)
at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty(Operators.java:2097)
at reactor.core.publisher.MonoReduceSeed$ReduceSeedSubscriber.onComplete(MonoReduceSeed.java:163)
at reactor.core.publisher.FluxWindowPredicate$WindowFlux.checkTerminated(FluxWindowPredicate.java:768)
at reactor.core.publisher.FluxWindowPredicate$WindowFlux.drainRegular(FluxWindowPredicate.java:662)
at reactor.core.publisher.FluxWindowPredicate$WindowFlux.drain(FluxWindowPredicate.java:748)
at reactor.core.publisher.FluxWindowPredicate$WindowFlux.onComplete(FluxWindowPredicate.java:814)
at reactor.core.publisher.FluxWindowPredicate$WindowPredicateMain.onNext(FluxWindowPredicate.java:243)
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)
at reactor.core.publisher.FluxFilter$FilterSubscriber.onNext(FluxFilter.java:113)
at reactor.core.publisher.FluxMap$MapConditionalSubscriber.onNext(FluxMap.java:224)
at reactor.core.publisher.FluxFilter$FilterConditionalSubscriber.onNext(FluxFilter.java:247)
at reactor.core.publisher.FluxTakeUntil$TakeUntilPredicateSubscriber.onNext(FluxTakeUntil.java:95)
at reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onNext(MonoFlatMapMany.java:251)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:539)
at reactor.core.publisher.FluxConcatMapNoPrefetch$FluxConcatMapNoPrefetchSubscriber.innerNext(FluxConcatMapNoPrefetch.java:259)
at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onNext(FluxConcatMap.java:865)
at reactor.core.publisher.FluxConcatMap$WeakScalarSubscription.request(FluxConcatMap.java:480)
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:2367)
The text was updated successfully, but these errors were encountered:
Bug description
NullPointerException happens during anthropic streaming
Environment
"org.springframework.ai:spring-ai-bom:1.0.0-SNAPSHOT
+org.springframework.ai:spring-ai-openai
+org.springframework.ai:spring-ai-anthropic-spring-boot-starter
Steps to reproduce
Unfortunately, it happens sometimes, probably it depends on the streaming response chain.
Prerequisites: Anthropic streaming call
The text was updated successfully, but these errors were encountered: