Federico Mariani created CAMEL-23949:
----------------------------------------
Summary: camel-langchain4j-embeddingstore: ADD without embedding
header calls EmbeddingStore.add(null) instead of failing
Key: CAMEL-23949
URL: https://issues.apache.org/jira/browse/CAMEL-23949
Project: Camel
Issue Type: Bug
Components: camel-langchain4j-embeddings
Affects Versions: 4.21.0
Reporter: Federico Mariani
Attachments: LangChain4jEmbeddingStoreMissingEmbeddingHeaderTest.java
The ADD action in {{LangChain4jEmbeddingStoreProducer.add()}} (lines 129-148)
does not validate that the {{CamelLangChain4jEmbeddingsEmbedding}} header is
present. When the header is missing, the producer calls
{{EmbeddingStore.add(null)}} — the store receives a null embedding and the
exchange completes without any error, unlike the missing-action case which is
properly rejected with {{NoSuchHeaderException}}.
Depending on the store implementation this either throws a store-specific NPE
later or silently persists garbage.
Attached reproducer {{LangChain4jEmbeddingStoreMissingEmbeddingHeaderTest}}
uses a recording stub store: it receives {{add(null)}} and the exchange carries
no exception.
*Fix*: fail fast with a meaningful validation error when the embedding header
is absent (same pattern as the action validation).
_This issue was drafted by Claude Code on behalf of Federico Mariani._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)