{"record":{"id":"291d289ca27c48a6","repo":"Mintplex-Labs/anything-llm","slug":"could-not-embed-document-chunks-this-document-wil-291d28","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/lance/index.js","lineNumber":394,"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          vectors.push(vectorRecord);\n          submissions.push({\n            ...vectorRecord.metadata,\n            id: vectorRecord.id,\n            vector: vectorRecord.values,\n          });\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      if (vectors.length > 0) {\n        const chunks = [];\n        for (const chunk of toChunks(vectors, 500)) chunks.push(chunk);\n\n        this.logger(\"Inserting vectorized chunks into LanceDB collection.\");\n        const { client } = await this.connect();\n        await this.updateOrCreateCollection(client, submissions, namespace);\n        await storeVectorResult(chunks, fullFilePath);\n      }\n\n      await DocumentVectors.bulkInsert(documentVectors);\n      return { vectorized: true, error: null };\n    } catch (e) {\n      this.logger(\"addDocumentToNamespace\", e.message);","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/20f6d3546c1938bfea1ad304f58a592dddcc5948/server/utils/vectorDbProviders/lance/index.js#L376-L412","documentation":"In LanceVectorDb.addDocumentToNamespace, when embedding produces no vectors the else branch throws before any LanceDB table is written, so the document is not recorded. Identical in intent to the AstraDB/Chroma 'Could not embed document chunks' guards: the failure is upstream in the embedding engine, not in LanceDB.","triggerScenarios":"Embedding a workspace document when the configured embedder returns an empty vector list: unreachable LocalAI/Ollama/LM Studio embedder, exhausted API quota, empty text after document parsing.","commonSituations":"EMBEDDING_ENGINE=ollama with the embedding model not pulled/loaded; embedder base-path env pointing at a stopped service; scanned PDFs with no text layer; embedder API key revoked.","solutions":["Validate the embedding engine first: embed a short string directly and confirm a non-empty vector array.","Fix credentials/base-path env (e.g. OLLAMA_BASE_PATH, LOCAL_AI_BASE_PATH, OPEN_AI_KEY) and restart.","Retry with a text-rich document to rule out empty extraction.","Re-embed the failed document once the embedder is healthy."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const vectors = await LLMConnector.embedChunks(textChunks);\nif (!Array.isArray(vectors) || vectors.length === 0) {\n  throw new Error('Embedding returned no vectors - check EMBEDDING_ENGINE and its endpoint.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const r = await vectorDb.addDocumentToNamespace(/* ... */);\n  if (!r.vectorized && /Could not embed document chunks/i.test(r.error)) {\n    return { ok: false, reason: 'embedding-engine' };\n  }\n} catch (e) { throw e; }","preventionTips":["Health-check the embedder before LanceDB ingest jobs (embed a probe string, assert length).","Pull/load local embedding models before starting ingest workers.","Validate documents have extracted text pre-embed."],"tags":["lancedb","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"}