Mintplex-Labs/anything-llm · error · Error

Error embedding into Weaviate

Error message

Error embedding into Weaviate

What it means

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.

Source

Thrown at server/utils/vectorDbProviders/weaviate/index.js:260

              const id = uuidv4();
              const flattenedMetadata = this.flattenObjectForWeaviate(
                chunk.properties ?? chunk.metadata
              );
              documentVectors.push({ docId, vectorId: id });
              const vectorRecord = {
                id,
                class: camelCase(namespace),
                vector: chunk.vector || chunk.values || [],
                properties: { ...flattenedMetadata },
              };
              vectors.push(vectorRecord);
            });

            const { success: additionResult, errors = [] } =
              await this.addVectors(client, vectors);
            if (!additionResult) {
              this.logger("addVectors failed to insert", errors);
              throw new Error("Error embedding into Weaviate");
            }
          }

          await DocumentVectors.bulkInsert(documentVectors);
          return { vectorized: true, error: null };
        }
      }

      // If we are here then we are going to embed and store a novel document.
      // We have to do this manually as opposed to using LangChains `Chroma.fromDocuments`
      // because we then cannot atomically control our namespace to granularly find/remove documents
      // from vectordb.
      const EmbedderEngine = getEmbeddingEngineSelection();
      const textSplitter = new TextSplitter({
        chunkSize: TextSplitter.determineMaxChunkSize(
          await SystemSettings.getValueOrFallback({
            label: "text_splitter_chunk_size",
          }),

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Read the server logs — the preceding 'addVectors failed to insert' entry prints the errors array with the exact batch-level cause
  2. 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
  3. Verify the class exists in Weaviate's schema and matches camelCase(namespace) with vectorizer 'none'
  4. Confirm Weaviate stays healthy during the import (memory/uptime) and shrink very large documents if batches time out
Defensive patterns

Strategy: try-catch

Validate before calling

const { client } = await provider.connect();
if (!(await provider.hasNamespace(namespace))) {
  throw new Error(`Class for namespace '${namespace}' missing — re-embed to recreate it`);
}

Try / catch

const { vectorized, error } = await provider.addDocumentToNamespace(...);
if (!vectorized) {
  logger.error("embed failed", error);
  if (/Error embedding into Weaviate/.test(String(error)))
    return queueForReembed(document); // cache/schema mismatch — re-embed fresh
  return failDocument(document, error);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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