{"record":{"id":"7228d162a116e7cd","repo":"Mintplex-Labs/anything-llm","slug":"could-not-embed-document-chunks-this-document-wil","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/astra/index.js","lineNumber":246,"sourceCode":"      this.logger(\"Snippets created from document:\", textChunks.length);\n      const documentVectors = [];\n      const vectors = [];\n      const vectorValues = await EmbedderEngine.embedChunks(textChunks);\n\n      if (!!vectorValues && vectorValues.length > 0) {\n        for (const [i, vector] of vectorValues.entries()) {\n          if (!vectorDimension) vectorDimension = vector.length;\n          const vectorRecord = {\n            _id: uuidv4(),\n            $vector: vector,\n            metadata: { ...metadata, text: textChunks[i] },\n          };\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      const { client } = await this.connect();\n      const collection = await this.getOrCreateCollection(\n        client,\n        namespace,\n        vectorDimension\n      );\n      if (!(await this.isRealCollection(collection)))\n        throw new Error(\"Failed to create new AstraDB collection!\", {\n          namespace,\n        });\n\n      if (vectors.length > 0) {\n        const chunks = [];\n\n        this.logger(\"Inserting vectorized chunks into Astra DB.\");","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/vectorDbProviders/astra/index.js#L228-L264","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const embedded = await LLMConnector.embedChunks(textChunks);\nif (!Array.isArray(embedded) || embedded.length === 0 || embedded.some((v) => !v?.length)) {\n  throw new Error('Embedder returned no/empty vectors - aborting before vector DB write.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await vectorDb.addDocumentToNamespace(/* ... */);\n} catch (e) {\n  if (/Could not embed document chunks/i.test(e.message)) {\n    // embedder-side issue: surface to user, do not retry unchanged\n    return { ok: false, reason: 'embedding-engine' };\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["astradb","vector-db","embedding","document-ingestion"],"backgroundTag":"embedding-failed","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}