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 when EMBEDDING_MODEL_PREF is unset. There is no default because LM Studio only serves the models you explicitly loaded; the embedder needs the exact id of a loaded embedding model. This check runs after the base-path check, so seeing it means EMBEDDING_BASE_PATH is already set.
Solutions
- Load an embedding model in LM Studio (not a chat model), e.g. nomic-embed-text-v1.5
- Copy its exact model id from LM Studio's server/UI
- Set EMBEDDING_MODEL_PREF to that id and restart
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=text-embedding-nomic-embed-text-v1.5
Defensive patterns
Strategy: validation
Validate before calling
function assertLMStudioModelSelected() {
if (!process.env.EMBEDDING_MODEL_PREF) {
throw new Error("LMStudio embedder needs EMBEDDING_MODEL_PREF set to a loaded embedding model id");
}
}
assertLMStudioModelSelected(); Try / catch
try {
const embedder = new LMStudioEmbedder();
} catch (e) {
if (e.message === "No embedding model was set.") {
// load an embedding model in LM Studio, then set its exact id here
}
throw e;
} Prevention
- Load a dedicated embedding model (e.g. nomic-embed-text-v1.5) and copy its exact id — chat models will fail later in embedChunks
- Populate the model dropdown from the live /models endpoint in the settings UI
- Block saving the embedding config with an empty model field
When it happens
Trigger: Configuring the LMStudio embedding engine with a URL but empty model field; deleting EMBEDDING_MODEL_PREF from .env; settings saved before a model was chosen.
Common situations: Assuming LM Studio embeds with 'whatever model is in the chat tab' — embeddings require a dedicated embedding model to be loaded (e.g. nomic-embed-text) and its id recorded here.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- No embedding base path was set.
- LMStudio Failed to embed
- LMStudio must have a valid model set.
- No embedding base path was set.
- No Embedding Model Pref was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/061ba23505da55b4.
Report an issue: GitHub.
Appendix: 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 3aec848f28)