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
I’ll trace
createAgenticSystemand the tool-provider registration path, then add a focused regression test and run the relevant agentic module tests. - Assistant
rgisn’t installed here, so I’m switching to repository-localfind/grepinspection. I’ll also preserve any unrelated working-tree changes. - Assistant
The duplicate is now isolated:
AgentBuilderalready applies all declarative suppliers in its constructor, andcreateAgenticSystem()applies them a second time. Because provider suppliers commonly return new instances, identity-based set deduplication cannot help; both static providers then expose the same tool. I’m refactoring the second pass to apply only the inherited/default model and the per-agent configurator. - Assistant
The implementation and regression test are in place. The test uses an
activate_skill-named static provider and asserts both the supplier and provider run exactly once; I’m now running formatting plus the focused Maven test across required modules. - Assistant
Maven attempted remote metadata resolution, so I stopped it immediately and switched the verification to offline mode, consistent with the no-internet constraint.
- Assistant
Compilation succeeded through the changed agentic module. The focused test launch is currently blocked only because offline Maven lacks the
surefire-junit-platform:3.5.5artifact; I’m checking whether the repository’s available formatter/test tooling can complete verification without fetching anything. - Assistant
The offline reactor has a second cache limitation for test-classifier snapshot artifacts, but the earlier run already compiled the implementation successfully. I’m completing the final compile/test directly against those reactor outputs, without dependency resolution.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.