Untitled conversation
- User
[BUG] Duplicate
activate_skilltool definition error when usingAgenticServices.createAgenticSystem()Describe the bug When creating an agentic system withAgenticServices.createAgenticSystem(), even with a single agent, the application throws anIllegalConfigurationException: Duplicated definition for tool: activate_skillduring execution, caused by multiple registrations of non-dynamicToolProviderinstances.Log and Stack trace
codeCaused by: dev.langchain4j.service.IllegalConfigurationException: Duplicated definition for tool: activate_skill at dev.langchain4j.service.tool.ToolService.addTools(ToolService.java:398) at dev.langchain4j.service.tool.ToolService.lambda$createContextFromStaticToolsAndProviders$0(ToolService.java:378) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at dev.langchain4j.service.tool.ToolService.createContextFromStaticToolsAndProviders(ToolService.java:371) at dev.langchain4j.service.tool.ToolService.createContext(ToolService.java:338) at dev.langchain4j.service.DefaultAiServices$1.invoke(DefaultAiServices.java:260) at dev.langchain4j.service.DefaultAiServices$1.invoke(DefaultAiServices.java:154) at jdk.proxy2/jdk.proxy2.$Proxy5.test(Unknown Source) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ... 5 moreTo Reproduce
java - Assistant
Now add the
hasChatModel()accessor toAgentBuilder: - Assistant
Now compile and run the module's tests:
- Assistant
Compiles. Now find where
Skills/activate_skilllives and check the existing tests: - Assistant
Test passes. Let me verify it actually fails without the fix (regression check):
- Assistant
Confirmed: without the fix, the tool provider supplier is invoked twice (duplicate registration). Now run the full agentic unit test suite to check for regressions:
- Assistant
All unit tests pass. Let me also check modules depending on
langchain4j-agenticstill compile (e.g., a2a): - Assistant
MCP tests pass. Let me apply the project code formatting:
- Assistant
The diff is clean — exactly the intended changes (spotless didn't alter anything before its ratchet failure, which is due to the detached checkout lacking an
origin/mainref, unrelated to this fix). Tests already passed with this exact state.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.