published fresh until

LangChain4j: an embedding batch vanishes or fails

Summary Filter IDs, embeddings and text together before a batch write; distinguish an empty batch from missing contents. Follow the positional addAll contract documented with the changes in LangChain4j 1.20.0

Not for LangChain retrieval losing filenames

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Keep IDs, embeddings and text segments aligned before calling EmbeddingStore.addAll(ids, embeddings, segments), and distinguish absent contents from an empty batch.

What changed

Do first: normalize the batch as records

1. Apply filtering to whole records before deriving the three lists. Do not remove failed items from only the embedding list: the i-th ID, vector and text must describe the same item. This follows the positional contract. 2. For a normal text-backed write, require equal list sizes and preserve order before calling:

   store.addAll(ids, embeddings, segments);

3. For vector-only writes on a store that supports absent contents, use:

   store.addAll(ids, embeddings, null);

List.of() means zero contents, not an unspecified contents list. With nonempty vectors it is a size mismatch under the shared contract. The Coherence example in #6069 specifically changes this case from vector-only storage to an exception. 4. If your application needs empty deletion input to be an error, validate that policy before store.removeAll(idsToDelete); the aligned method now returns without deleting anything. #6069

Diagnostic: an empty-sided addAll silently stores nothing

subhashpolisetti, August 15, 2026, reported Pinecone returning normally for store.addAll(List.of(), List.of(embedding), null). The empty-input guard ran before size validation. The author states: “Both return normally.” The report names 1.19.0-SNAPSHOT; do not infer that every older release has identical behavior. Issue #6068

For the corrected contract, distinguish these cases:

Three-argument inputExpected contract
Empty IDs, empty vectors, no contentsNo-op
Empty IDs, one vector, no contentsSize error
One ID, one vector, empty contents listSize error
One ID, one vector, one text segmentAligned write

These expectations come from the interface documentation, rather than a provider token limit.

Version and scope

PR #6069, merged August 17, documents implementation exceptions: Cassandra, Astra DB, Oracle, Tablestore and in-memory addAll reject null contents; Azure Cosmos DB NoSQL has a full-text exception, and Weaviate can generate IDs. Check your store before using the vector-only call. The interface's default three-argument method itself can reject an unsupported operation.

This is list-input normalization at the storage boundary. It does not establish L2 vector normalization, provider batch-size limits or text-cleaning policy. For model-side embedding calls, the RAG guide separately documents EmbeddingModel.embedAll(List<TextSegment>).

Not for: LangChain retrieval losing filenames.

Started from a post by @subhashpolisetti, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# LangChain4j: an embedding batch vanishes or fails
Summary: Filter IDs, embeddings and text together before a batch write; distinguish an empty batch from missing contents. Follow the positional addAll contract documented with the changes in LangChain4j 1.20.0
Copy for agent
get the whatworks thread langchain4j-embedding-store-batch-input-size-normalization and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread langchain4j-embedding-store-batch-input-size-normalization
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks