Mintplex-Labs/anything-llm · error · Error
Could not embed document chunks! This document will not be r
Error message
Could not embed document chunks! This document will not be recorded.
What it means
In AstraDB's addDocumentToNamespace, after embedding the document the code builds vector records from vectorValues; when the embedder returned no vectors at all (vectorValues empty/absent), the else branch throws this error and the document is skipped from the vector store. It guards against writing a document with zero embeddings.
Source
Thrown at server/utils/vectorDbProviders/astra/index.js:246
this.logger("Snippets created from document:", textChunks.length);
const documentVectors = [];
const vectors = [];
const vectorValues = await EmbedderEngine.embedChunks(textChunks);
if (!!vectorValues && vectorValues.length > 0) {
for (const [i, vector] of vectorValues.entries()) {
if (!vectorDimension) vectorDimension = vector.length;
const vectorRecord = {
_id: uuidv4(),
$vector: vector,
metadata: { ...metadata, text: textChunks[i] },
};
vectors.push(vectorRecord);
documentVectors.push({ docId, vectorId: vectorRecord._id });
}
} else {
throw new Error(
"Could not embed document chunks! This document will not be recorded."
);
}
const { client } = await this.connect();
const collection = await this.getOrCreateCollection(
client,
namespace,
vectorDimension
);
if (!(await this.isRealCollection(collection)))
throw new Error("Failed to create new AstraDB collection!", {
namespace,
});
if (vectors.length > 0) {
const chunks = [];
this.logger("Inserting vectorized chunks into Astra DB.");View on GitHub (pinned to 3aec848f28)
Solutions
- Check the embedding engine logs/credentials first - the embedder silently returning [] is the usual root cause.
- Verify the document actually contains extractable text (re-upload as .txt/.md to test).
- Test the embedder directly with a one-line input (e.g. curl the embeddings endpoint) to confirm non-empty vectors.
- Once the embedder returns vectors, delete and re-embed the failed document.
Defensive patterns
Strategy: validation
Validate before calling
const embedded = await LLMConnector.embedChunks(textChunks);
if (!Array.isArray(embedded) || embedded.length === 0 || embedded.some((v) => !v?.length)) {
throw new Error('Embedder returned no/empty vectors - aborting before vector DB write.');
} Try / catch
try {
await vectorDb.addDocumentToNamespace(/* ... */);
} catch (e) {
if (/Could not embed document chunks/i.test(e.message)) {
// embedder-side issue: surface to user, do not retry unchanged
return { ok: false, reason: 'embedding-engine' };
}
throw e;
} Prevention
- Smoke-test the embedder at deploy time with a known input and assert vector length.
- Alert on zero-vector batches in embedder wrappers instead of passing them downstream.
- Validate documents have extracted text before embedding.
When it happens
Trigger: Embedding a document whose textChunks/vectorValues came back empty: embedder endpoint down but returning 200 with empty data, document text extraction produced nothing, or a workspace embed with zero usable chunks.
Common situations: Embedding engine credentials revoked or quota exhausted so batches return empty results; empty/ scanned PDFs; LM Studio/Ollama model unloaded returning no embeddings; mismatch between chosen embedder and the model it serves.
Related errors
- AstraDB:getOrCreateCollection Unable to infer vector dimensi
- Could not embed document chunks! This document will not be r
- Could not embed document chunks! This document will not be r
- Failed to create new AstraDB collection!
- Error embedding into Weaviate
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/7228d162a116e7cd.
Report an issue: GitHub.