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 ChromaVectorDb.addDocumentToNamespace, if embedding the document yields no vectors (vectorValues empty), the else branch throws this error before any Chroma interaction, so the document is never recorded. It is the Chroma twin of the AstraDB 'Could not embed document chunks' guard and points at the embedding engine, not at Chroma.

Source

Thrown at server/utils/vectorDbProviders/chroma/index.js:314

          const vectorRecord = {
            id: uuidv4(),
            values: vector,
            // [DO NOT REMOVE]
            // LangChain will be unable to find your text if you embed manually and dont include the `text` key.
            // https://github.com/hwchase17/langchainjs/blob/2def486af734c0ca87285a48f1a04c057ab74bdf/langchain/src/vectorstores/pinecone.ts#L64
            metadata: { ...metadata, text: textChunks[i] },
          };

          submission.ids.push(vectorRecord.id);
          submission.embeddings.push(vectorRecord.values);
          submission.metadatas.push(metadata);
          submission.documents.push(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 client.getOrCreateCollection({
        name: this.normalize(namespace),
        metadata: { "hnsw:space": "cosine" },
      });

      if (vectors.length > 0) {
        const chunks = [];
        this.logger("Inserting vectorized chunks into Chroma collection.");
        for (const chunk of toChunks(vectors, 500)) chunks.push(chunk);

        try {
          await this.smartAdd(collection, submission);
          this.logger(

View on GitHub (pinned to 20f6d3546c)

Solutions

  1. Check embedding engine logs and test it with a trivial input to confirm it returns vectors.
  2. Verify EMBEDDING_ENGINE + its credentials (e.g. LOCAL_AI_BASE_PATH, OLLAMA_BASE_PATH, OPEN_AI_KEY) in .env, then restart.
  3. Confirm the source document has extractable text; re-test with a small .txt file.
  4. After the embedder is fixed, remove and re-embed the failed document.
Defensive patterns

Strategy: validation

Validate before calling

const vectors = await LLMConnector.embedChunks(textChunks);
if (!vectors?.length) throw new Error('Embedder returned zero vectors - fix EMBEDDING_ENGINE config.');
await vectorDb.addDocumentToNamespace(/* ... */);

Try / catch

try {
  const r = await vectorDb.addDocumentToNamespace(/* ... */);
  if (!r.vectorized && /Could not embed document chunks/i.test(r.error)) {
    // embedder issue - surface clearly, no blind retry
  }
} catch (e) { throw e; }

Prevention

When it happens

Trigger: Workspace embed / document upload where the embedder returns an empty list: dead embedding endpoint, revoked API key, empty text after parsing, or an unloadable local embedding model.

Common situations: EMBEDDING_ENGINE pointing at a stopped LocalAI/Ollama/LM Studio instance; OpenAI embedder key pasted with whitespace; scanned PDF with no OCR layer; embedder model name typo returning empty batches.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@20f6d3546c (2026-08-18). Data as JSON: /api/errors/3e25f421b35e8cce. Report an issue: GitHub.