oscerd opened a new pull request, #26077: URL: https://github.com/apache/camel/pull/26077
## Issue [CAMEL-24614](https://issues.apache.org/jira/browse/CAMEL-24614) ## Problem `LangChain4jAgentProducer` resolves the agent from the registry with `lookupByNameAndType(agentId, Agent.class)`, which returns `null` when no matching bean exists. With no `agent`/`agentConfiguration`/`agentFactory` configured and no registry bean named `agentId`, `agent` stays `null` and `process()` fails with an opaque `NullPointerException` at `agent.chat(...)` instead of a clear configuration error. ## Fix Validate in `doStart()` (where both `agent` and `agentFactory` are resolved) that an agent or an agentFactory is available, and throw a clear `IllegalArgumentException` naming the endpoint and the configuration options otherwise. ## Testing - New `LangChain4jAgentMissingAgentTest` starts a producer for an endpoint with an unresolvable agent and asserts the clear `IllegalArgumentException` is raised. - `mvn -Psourcecheck validate` green. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
