Mintplex-Labs/anything-llm · critical · Error
No embedding model was set.
Error message
No embedding model was set.
What it means
Thrown by the LMStudioEmbedder constructor (line 12) when process.env.EMBEDDING_MODEL_PREF is falsy, immediately after the base-path check. The model identifier is required because it is passed as the `model` field to every /embeddings request; an empty value would make LMStudio reject or misroute the call. This guard fails fast before any network work.
Source
Thrown at server/utils/EmbeddingEngines/lmstudio/index.js:12
const { parseLMStudioBasePath } = require("../../AiProviders/lmStudio");
const {
maximumChunkLength,
reportEmbeddingProgress,
} = require("../../helpers");
class LMStudioEmbedder {
constructor() {
if (!process.env.EMBEDDING_BASE_PATH)
throw new Error("No embedding base path was set.");
if (!process.env.EMBEDDING_MODEL_PREF)
throw new Error("No embedding model was set.");
const apiKey = process.env.LMSTUDIO_AUTH_TOKEN ?? null;
this.className = "LMStudioEmbedder";
const { OpenAI: OpenAIApi } = require("openai");
this.lmstudio = new OpenAIApi({
baseURL: parseLMStudioBasePath(process.env.EMBEDDING_BASE_PATH),
apiKey,
});
this.model = process.env.EMBEDDING_MODEL_PREF;
// Limit of how many strings we can process in a single pass to stay with resource or network limits
this.maxConcurrentChunks = 1;
this.embeddingMaxChunkLength = maximumChunkLength();
}
log(text, ...args) {
console.log(`\x1b[36m[${this.className}]\x1b[0m ${text}`, ...args);
}View on GitHub (pinned to 526360e320)
Solutions
- Set EMBEDDING_MODEL_PREF to the exact model name loaded in LMStudio (visible in its UI), e.g. nomic-ai/nomic-embed-text-v1.5
- Verify the string matches LMStudio's loaded model identifier exactly (case/hyphens)
- Reload AnythingLLM env after editing .env
Example fix
// before EMBEDDING_BASE_PATH=http://localhost:1234/v1 // EMBEDDING_MODEL_PREF unset // after EMBEDDING_BASE_PATH=http://localhost:1234/v1 EMBEDDING_MODEL_PREF=nomic-ai/nomic-embed-text-v1.5
Defensive patterns
Strategy: validation
Validate before calling
function hasEmbeddingModelPref(env = process.env) {
return typeof env.EMBEDDING_MODEL_PREF === 'string' &&
env.EMBEDDING_MODEL_PREF.trim().length > 0;
}
if (!hasEmbeddingModelPref()) {
throw new Error('Missing EMBEDDING_MODEL_PREF for LMStudio.');
} Type guard
function isNonEmptyModel(v) {
return typeof v === 'string' && v.trim().length > 0;
} Prevention
- Copy the model identifier verbatim from LMStudio's loaded-models list.
- Treat base path and model as a required pair — set both together.
- Validate env in a single boot check covering all local engines.
When it happens
Trigger: Instantiating `new LMStudioEmbedder()` with EMBEDDING_MODEL_PREF unset/empty. Happens at construction, before #isAlive or any embedding call. Typically when the UI/system settings saved a base path but no model, or .env is partially configured.
Common situations: User loaded a model into LMStudio but did not set the matching EMBEDDING_MODEL_PREF in AnythingLLM; model name copied with a typo; switching engines and the previous model env was cleared; fresh install where only EMBEDDING_BASE_PATH was set.
Related errors
- No embedding base path was set.
- LiteLLM must have a valid base path to use for the api.
- No embedding base path was set.
- No embedding model was set.
- No Mistral API key was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/061ba23505da55b4.
Report an issue: GitHub.