Mintplex-Labs/anything-llm · critical · Error

No Embedding Model Pref was set.

Error message

No Embedding Model Pref was set.

What it means

Thrown in the LemonadeEmbedder constructor when process.env.EMBEDDING_MODEL_PREF is falsy, immediately after the base-path check. Lemonade requires an explicit model id because the server hosts whatever models were loaded into it; there is no safe default.

Source

Thrown at server/utils/EmbeddingEngines/lemonade/index.js:9

const { parseLemonadeServerEndpoint } = require("../../AiProviders/lemonade");
const { toChunks, reportEmbeddingProgress } = require("../../helpers");

class LemonadeEmbedder {
  constructor() {
    if (!process.env.EMBEDDING_BASE_PATH)
      throw new Error("No Lemonade API Base Path was set.");
    if (!process.env.EMBEDDING_MODEL_PREF)
      throw new Error("No Embedding Model Pref was set.");
    this.className = "LemonadeEmbedder";
    const { OpenAI: OpenAIApi } = require("openai");
    this.lemonade = new OpenAIApi({
      baseURL: parseLemonadeServerEndpoint(
        process.env.EMBEDDING_BASE_PATH,
        "openai"
      ),
      apiKey: process.env.LEMONADE_LLM_API_KEY || null,
    });
    this.model = process.env.EMBEDDING_MODEL_PREF;

    this.maxConcurrentChunks = 50;
    this.embeddingMaxChunkLength =
      process.env.EMBEDDING_MODEL_MAX_CHUNK_LENGTH || 8_191;
  }

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

View on GitHub (pinned to 526360e320)

Solutions

  1. Set EMBEDDING_MODEL_PREF to a model loaded in the Lemonade server (verify via its model list).
  2. Load the embedding model into the Lemonade server if it is not present.
  3. Restart the process after setting the var.
  4. Confirm EMBEDDING_BASE_PATH is also set (the prior check).
Defensive patterns

Strategy: validation

Validate before calling

function assertLemonadeModel() {
  if (!process.env.EMBEDDING_MODEL_PREF) {
    throw new Error('Missing env EMBEDDING_MODEL_PREF (Lemonade embedding model id)');
  }
}
assertLemonadeModel();

Try / catch

try {
  new LemonadeEmbedder();
} catch (e) {
  if (/model pref/i.test(e.message)) { /* prompt for embedding model id */ }
  throw e;
}

Prevention

When it happens

Trigger: Constructing LemonadeEmbedder while EMBEDDING_MODEL_PREF is unset; model id left blank; embedding model not loaded into the Lemonade server.

Common situations: Switching to Lemonade without naming an embedding model; model unloaded from the Lemonade server; typo in the model id.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/96b816fc3cd49362. Report an issue: GitHub.