{"record":{"id":"2d57cda09e1d5d65","repo":"Mintplex-Labs/anything-llm","slug":"error-embedding-into-weaviate","errorCode":null,"errorMessage":"Error embedding into Weaviate","messagePattern":"Error embedding into Weaviate","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/vectorDbProviders/weaviate/index.js","lineNumber":260,"sourceCode":"              const id = uuidv4();\n              const flattenedMetadata = this.flattenObjectForWeaviate(\n                chunk.properties ?? chunk.metadata\n              );\n              documentVectors.push({ docId, vectorId: id });\n              const vectorRecord = {\n                id,\n                class: camelCase(namespace),\n                vector: chunk.vector || chunk.values || [],\n                properties: { ...flattenedMetadata },\n              };\n              vectors.push(vectorRecord);\n            });\n\n            const { success: additionResult, errors = [] } =\n              await this.addVectors(client, vectors);\n            if (!additionResult) {\n              this.logger(\"addVectors failed to insert\", errors);\n              throw new Error(\"Error embedding into Weaviate\");\n            }\n          }\n\n          await DocumentVectors.bulkInsert(documentVectors);\n          return { vectorized: true, error: null };\n        }\n      }\n\n      // If we are here then we are going to embed and store a novel document.\n      // We have to do this manually as opposed to using LangChains `Chroma.fromDocuments`\n      // because we then cannot atomically control our namespace to granularly find/remove documents\n      // from vectordb.\n      const EmbedderEngine = getEmbeddingEngineSelection();\n      const textSplitter = new TextSplitter({\n        chunkSize: TextSplitter.determineMaxChunkSize(\n          await SystemSettings.getValueOrFallback({\n            label: \"text_splitter_chunk_size\",\n          }),","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/vectorDbProviders/weaviate/index.js#L242-L278","documentation":"On the cached-document re-embed path of addDocumentToNamespace, vectors restored from the local cache file are pushed via addVectors (a Weaviate batch import). When the batch response reports success:false this generic message is thrown; the per-item causes were just logged with this.logger(\"addVectors failed to insert\", errors), so the real reason is in the server log, not the exception.","triggerScenarios":"Weaviate batch import returning errors: the target class (camelCase namespace) was dropped/renamed after the cache was written; vector dimensions in the cached file no longer match the class schema; connection dropped mid-batch; batch payload too large causing timeout; required properties rejected.","commonSituations":"Re-embedding a workspace after someone deleted its Weaviate class manually; switching embedding engine (dimension change, e.g. 384 to 1536) without resetting the vector DB; large cached documents timing out; Weaviate container restarting or OOM-killed during import.","solutions":["Read the server logs — the preceding 'addVectors failed to insert' entry prints the errors array with the exact batch-level cause","If the embedding model changed, delete the namespace/class (or reset the DB) and re-embed so the class is recreated with the new dimensionality","Verify the class exists in Weaviate's schema and matches camelCase(namespace) with vectorizer 'none'","Confirm Weaviate stays healthy during the import (memory/uptime) and shrink very large documents if batches time out"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const { client } = await provider.connect();\nif (!(await provider.hasNamespace(namespace))) {\n  throw new Error(`Class for namespace '${namespace}' missing — re-embed to recreate it`);\n}","typeGuard":null,"tryCatchPattern":"const { vectorized, error } = await provider.addDocumentToNamespace(...);\nif (!vectorized) {\n  logger.error(\"embed failed\", error);\n  if (/Error embedding into Weaviate/.test(String(error)))\n    return queueForReembed(document); // cache/schema mismatch — re-embed fresh\n  return failDocument(document, error);\n}","preventionTips":["Check the class exists and its vector width matches the current embedder before re-embedding cached documents","After changing embedding models, reset affected namespaces so cached vectors cannot mismatch the schema","Capture the addVectors errors array in logs — the thrown message is generic and useless alone"],"tags":["weaviate","vector-db","embedding","batch-insert"],"backgroundTag":"vector-insert-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"}