Mintplex-Labs/anything-llm · error · Error

Could not embed document chunks! This document will not be…

Error message

Could not embed document chunks! This document will not be recorded.

What it means

On the novel-document path, pageContent is split into chunks and EmbedderEngine.embedChunks(textChunks) is called. If that returns null/undefined or an empty array (the `!!vectorValues && vectorValues.length > 0` check fails), the code refuses to record the document and throws. The failure is in the embedding engine layer, before Weaviate is ever contacted.

Solutions

  1. Open Admin settings and re-verify the embedding engine selection and its API key/endpoint, then save
  2. Test the embedder directly (e.g. curl the provider /embeddings endpoint) with the configured credentials
  3. Check document processing logs for 'Snippets created from document: 0' — an empty extraction also produces no vectors
  4. After fixing/changing the embedder, re-upload the document so fresh chunks and vectors are generated
Defensive patterns

Strategy: validation

Validate before calling

const embedder = getEmbeddingEngineSelection();
if (!embedder) throw new Error("No embedding engine configured — set one in admin settings");
const chunks = await textSplitter.splitText(pageContent);
if (chunks.length === 0) throw new Error("Document produced no text chunks");
const vectors = await embedder.embedChunks(chunks);
if (!vectors?.length) throw new Error("Embedder returned no vectors — check credentials");

Try / catch

const { vectorized, error } = await provider.addDocumentToNamespace(...);
if (!vectorized && /Could not embed document chunks/.test(String(error)))
  haltIngestion("Embedding engine failure — verify provider config before retrying", error);

Prevention

When it happens

Trigger: Embedding engine unconfigured or misselected in admin settings; embedder API key invalid, quota exhausted, or endpoint unreachable so embedChunks yields nothing; the document produced zero text chunks (empty extraction); local embedding runtime missing on the host.

Common situations: Default OpenAI embedder kept while OPEN_AI_KEY was never set; switching embedder providers without re-verifying credentials; uploading an empty or unparseable file (0 chunks); all-native/local embedder binary not installed; embedder service temporarily down.

Related errors


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

Appendix: source

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

          const vectorRecord = {
            class: camelCase(namespace),
            id: uuidv4(),
            vector: vector,
            // [DO NOT REMOVE]
            // LangChain will be unable to find your text if you embed manually and dont include the `text` key.
            // https://github.com/hwchase17/langchainjs/blob/5485c4af50c063e257ad54f4393fa79e0aff6462/langchain/src/vectorstores/weaviate.ts#L133
            properties: { ...flattenedMetadata, text: textChunks[i] },
          };

          submission.ids.push(vectorRecord.id);
          submission.vectors.push(vectorRecord.values);
          submission.properties.push(metadata);

          vectors.push(vectorRecord);
          documentVectors.push({ docId, vectorId: vectorRecord.id });
        }
      } else {
        throw new Error(
          "Could not embed document chunks! This document will not be recorded."
        );
      }

      const { client } = await this.connect();
      const weaviateClassExits = await this.hasNamespace(namespace);
      if (!weaviateClassExits) {
        await client.schema
          .classCreator()
          .withClass({
            class: camelCase(namespace),
            description: `Class created by AnythingLLM named ${camelCase(
              namespace
            )}`,
            vectorizer: "none",
          })
          .do();
      }

View on GitHub (pinned to 3aec848f28)