Mintplex-Labs/anything-llm · error · Error

No Embedding Model preference defined.

Error message

No Embedding Model preference defined.

What it means

Guard in AzureOpenAiEmbedder.embedChunks: this.model is null because no embedding model preference was configured at construction, so the embedder has no deployment/model name to pass in the embedding request.

Solutions

  1. Set the embedding model deployment name in embedder settings.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown when no embedding model preference is defined.

Common situations: Azure embedder selected without a deployment/model preference.


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

Appendix: source

Thrown at server/utils/EmbeddingEngines/azureOpenAi/index.js:44

    this.maxConcurrentChunks = 16;

    // https://learn.microsoft.com/en-us/answers/questions/1188074/text-embedding-ada-002-token-context-length
    this.embeddingMaxChunkLength = 2048;
  }

  log(text, ...args) {
    console.log(`\x1b[36m[${this.className}]\x1b[0m ${text}`, ...args);
  }

  async embedTextInput(textInput) {
    const result = await this.embedChunks(
      Array.isArray(textInput) ? textInput : [textInput]
    );
    return result?.[0] || [];
  }

  async embedChunks(textChunks = []) {
    if (!this.model) throw new Error("No Embedding Model preference defined.");

    this.log(`Embedding ${textChunks.length} chunks...`);
    // Because there is a limit on how many chunks can be sent at once to Azure OpenAI
    // we concurrently execute each max batch of text chunks possible.
    // Refer to constructor maxConcurrentChunks for more info.
    const embeddingRequests = [];
    let chunksProcessed = 0;
    for (const chunk of toChunks(textChunks, this.maxConcurrentChunks)) {
      embeddingRequests.push(
        new Promise((resolve) => {
          this.openai.embeddings
            .create({
              model: this.model,
              input: chunk,
            })
            .then((res) => {
              chunksProcessed += chunk.length;
              reportEmbeddingProgress(chunksProcessed, textChunks.length);

View on GitHub (pinned to 3aec848f28)