{"record":{"id":"96b816fc3cd49362","repo":"Mintplex-Labs/anything-llm","slug":"no-embedding-model-pref-was-set","errorCode":null,"errorMessage":"No Embedding Model Pref was set.","messagePattern":"No Embedding Model Pref was set\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"server/utils/EmbeddingEngines/lemonade/index.js","lineNumber":9,"sourceCode":"const { parseLemonadeServerEndpoint } = require(\"../../AiProviders/lemonade\");\nconst { toChunks, reportEmbeddingProgress } = require(\"../../helpers\");\n\nclass LemonadeEmbedder {\n  constructor() {\n    if (!process.env.EMBEDDING_BASE_PATH)\n      throw new Error(\"No Lemonade API Base Path was set.\");\n    if (!process.env.EMBEDDING_MODEL_PREF)\n      throw new Error(\"No Embedding Model Pref was set.\");\n    this.className = \"LemonadeEmbedder\";\n    const { OpenAI: OpenAIApi } = require(\"openai\");\n    this.lemonade = new OpenAIApi({\n      baseURL: parseLemonadeServerEndpoint(\n        process.env.EMBEDDING_BASE_PATH,\n        \"openai\"\n      ),\n      apiKey: process.env.LEMONADE_LLM_API_KEY || null,\n    });\n    this.model = process.env.EMBEDDING_MODEL_PREF;\n\n    this.maxConcurrentChunks = 50;\n    this.embeddingMaxChunkLength =\n      process.env.EMBEDDING_MODEL_MAX_CHUNK_LENGTH || 8_191;\n  }\n\n  log(text, ...args) {\n    console.log(`\\x1b[36m[${this.className}]\\x1b[0m ${text}`, ...args);","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/EmbeddingEngines/lemonade/index.js#L1-L27","documentation":"Thrown by the LemonadeEmbedder constructor when EMBEDDING_MODEL_PREF is unset. Unlike engines with a default model, the Lemonade embedder requires an explicit model id because it cannot guess which model your local Lemonade server has loaded. It is checked after the base-path guard, so seeing this error means EMBEDDING_BASE_PATH is already present.","triggerScenarios":"Configuring the Lemonade embedding engine with a base path but leaving the model preference empty; EMBEDDING_MODEL_PREF removed from .env; model field cleared in the settings UI and saved.","commonSituations":"Admins who assumed Lemonade would use whatever model is currently loaded; copying a config template that only filled in the server URL.","solutions":["List the models available on your Lemonade server (its UI or OpenAI-compatible /models endpoint) and copy the exact id","Set EMBEDDING_MODEL_PREF to that id","Make sure the model is loaded/downloaded on the server so the id is valid","Restart the backend and re-embed"],"exampleFix":"# before\nEMBEDDING_BASE_PATH=http://localhost:8080\n# EMBEDDING_MODEL_PREF unset\n\n# after\nEMBEDDING_BASE_PATH=http://localhost:8080\nEMBEDDING_MODEL_PREF=onnx-community/Llama-3.2-1B","handlingStrategy":"validation","validationCode":"function assertLemonadeModelSelected() {\n  if (!process.env.EMBEDDING_MODEL_PREF) {\n    throw new Error(\"Lemonade embedder needs EMBEDDING_MODEL_PREF set to a model id the server has loaded\");\n  }\n}\nassertLemonadeModelSelected();","typeGuard":null,"tryCatchPattern":"try {\n  const embedder = new LemonadeEmbedder();\n} catch (e) {\n  if (e.message === \"No Embedding Model Pref was set.\") {\n    // fetch the server's model list and have the user pick one\n  }\n  throw e;\n}","preventionTips":["Pull the model list from the Lemonade server and enforce choosing one in the settings UI","Re-validate the model preference whenever the Lemonade server's loaded models change","Treat an empty model field as a blocking validation error in the config form, not a warning"],"tags":["lemonade","amd","env-var","model-name","constructor"],"backgroundTag":"missing-env-var","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}