Cannot invoke "String.equals(Object)" because "toolName" is null

Open
#2,813 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
java, spring-boot

Research direction

Start by reproducing the error with the shown UserTools, @Tool, ChatClient, and streaming setup on spring-ai-bom 1.0.0-M6, then trace the reported MessageAggregator aggregation error. Done means the tool call completes without a NullPointerException when toolName is null.

Written by the indexing model from the issue text.

Description

status: waiting-for-triage

Bug description
Sending OK to call Tool Calling error: ERROR 29356 --- [ient-2-Worker-0] o.s.ai.chat.model.MessageAggregator : Aggregation Error

java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "toolName" is null

Environment
spring-ai-bom:1.0.0-M6
spring-ai-openai-spring-boot-starter
JDK21

Steps to reproduce
@Component
public class UserTools {
@Tool(name = "getOK",description = "OK")
public String getOK() {
return "ok!ok!ok!";
}
}

@Autowired
private UserTools userTools;
@Bean
public ChatClient chatClient(OpenAiChatModel model, ChatMemory chatMemory) {
return ChatClient
.builder(model)
.defaultSystem("""
你是小清,一个温柔可爱机智的智能助手。
""")
.defaultTools(userTools) // Tool Calling
.build();
}

@Operation(summary = "对话")
@PostMapping(value = "/conversation",produces = "text/html;charset=utf-8")
public Flux chatClient(@RequestBody ChatDto chatDto) {
return chatClient.prompt()
.user(chatDto.getPrompt())
.stream()
.content();
}

Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 10h
Merged PRs (30d)
5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from spring-projects/spring-ai

All issues in spring-projects/spring-ai

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.