{"record":{"id":"3e25f421b35e8cce","repo":"Mintplex-Labs/anything-llm","slug":"could-not-embed-document-chunks-this-document-wil-3e25f4","errorCode":null,"errorMessage":"Could not embed document chunks! This document will not be recorded.","messagePattern":"Could not embed document chunks! This document will not be recorded\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/vectorDbProviders/chroma/index.js","lineNumber":314,"sourceCode":"          const vectorRecord = {\n            id: uuidv4(),\n            values: vector,\n            // [DO NOT REMOVE]\n            // LangChain will be unable to find your text if you embed manually and dont include the `text` key.\n            // https://github.com/hwchase17/langchainjs/blob/2def486af734c0ca87285a48f1a04c057ab74bdf/langchain/src/vectorstores/pinecone.ts#L64\n            metadata: { ...metadata, text: textChunks[i] },\n          };\n\n          submission.ids.push(vectorRecord.id);\n          submission.embeddings.push(vectorRecord.values);\n          submission.metadatas.push(metadata);\n          submission.documents.push(textChunks[i]);\n\n          vectors.push(vectorRecord);\n          documentVectors.push({ docId, vectorId: vectorRecord.id });\n        }\n      } else {\n        throw new Error(\n          \"Could not embed document chunks! This document will not be recorded.\"\n        );\n      }\n\n      const { client } = await this.connect();\n      const collection = await client.getOrCreateCollection({\n        name: this.normalize(namespace),\n        metadata: { \"hnsw:space\": \"cosine\" },\n      });\n\n      if (vectors.length > 0) {\n        const chunks = [];\n        this.logger(\"Inserting vectorized chunks into Chroma collection.\");\n        for (const chunk of toChunks(vectors, 500)) chunks.push(chunk);\n\n        try {\n          await this.smartAdd(collection, submission);\n          this.logger(","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/20f6d3546c1938bfea1ad304f58a592dddcc5948/server/utils/vectorDbProviders/chroma/index.js#L296-L332","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check embedding engine logs and test it with a trivial input to confirm it returns vectors.","Verify EMBEDDING_ENGINE + its credentials (e.g. LOCAL_AI_BASE_PATH, OLLAMA_BASE_PATH, OPEN_AI_KEY) in .env, then restart.","Confirm the source document has extractable text; re-test with a small .txt file.","After the embedder is fixed, remove and re-embed the failed document."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const vectors = await LLMConnector.embedChunks(textChunks);\nif (!vectors?.length) throw new Error('Embedder returned zero vectors - fix EMBEDDING_ENGINE config.');\nawait vectorDb.addDocumentToNamespace(/* ... */);","typeGuard":null,"tryCatchPattern":"try {\n  const r = await vectorDb.addDocumentToNamespace(/* ... */);\n  if (!r.vectorized && /Could not embed document chunks/i.test(r.error)) {\n    // embedder issue - surface clearly, no blind retry\n  }\n} catch (e) { throw e; }","preventionTips":["Verify the embedding engine endpoint is up before bulk uploads.","Test one document per workspace after any embedder config change.","Reject zero-text documents pre-embed."],"tags":["chroma","vector-db","embedding","document-ingestion"],"backgroundTag":"embedding-failed","analyzedSha":"20f6d3546c1938bfea1ad304f58a592dddcc5948","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}