Mintplex-Labs/anything-llm · critical · Error
No embedding model was set.
Error message
No embedding model was set.
What it means
Thrown by the LocalAiEmbedder constructor when EMBEDDING_MODEL_PREF is unset. LocalAI models must be installed explicitly (via its model gallery or config), so there is no safe default model id; the constructor demands the exact name of an installed embedding model. It runs after the base-path check, so this error implies the URL is already configured.
Solutions
- Install an embedding model in LocalAI (gallery: e.g. 'localai' provides bert-embeddings / sentence-transformers backends)
- Copy the exact installed model name into EMBEDDING_MODEL_PREF
- Restart the backend and re-embed the failed documents
Example fix
# before EMBEDDING_BASE_PATH=http://localhost:8080/v1 # EMBEDDING_MODEL_PREF unset # after EMBEDDING_BASE_PATH=http://localhost:8080/v1 EMBEDDING_MODEL_PREF=bert-embeddings
Defensive patterns
Strategy: validation
Validate before calling
function assertLocalAiModelSelected() {
if (!process.env.EMBEDDING_MODEL_PREF) {
throw new Error("LocalAI embedder needs EMBEDDING_MODEL_PREF set to an installed embedding model");
}
}
assertLocalAiModelSelected(); Try / catch
try {
const embedder = new LocalAiEmbedder();
} catch (e) {
if (e.message === "No embedding model was set.") {
// install an embedding model from the LocalAI gallery, then set its exact name
}
throw e;
} Prevention
- Install the embedding model in LocalAI before configuring AnythingLLM's embedding engine
- Copy the model name verbatim from the LocalAI gallery/config (backend names matter)
- Treat model installation and model preference as one setup step so they cannot drift
When it happens
Trigger: Configuring LocalAI embeddings with a URL but empty model field; the model was uninstalled from LocalAI but the preference left blank; settings saved mid-configuration.
Common situations: Fresh LocalAI installs where no embedding backend (e.g. bert-embeddings) has been pulled from the gallery yet; model name mismatch between the gallery id and what the user typed.
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.
- No Embedding Model Pref was set.
- No embedding model was set.
- ${error.message}
- GenericOpenAI must have a valid base path to use for the…
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/8141341434a9b824.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/EmbeddingEngines/localAi/index.js:12
const {
toChunks,
maximumChunkLength,
reportEmbeddingProgress,
} = require("../../helpers");
class LocalAiEmbedder {
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.");
this.className = "LocalAiEmbedder";
const { OpenAI: OpenAIApi } = require("openai");
this.model = process.env.EMBEDDING_MODEL_PREF;
this.openai = new OpenAIApi({
baseURL: process.env.EMBEDDING_BASE_PATH,
apiKey: process.env.LOCAL_AI_API_KEY ?? null,
});
// Limit of how many strings we can process in a single pass to stay with resource or network limits
this.maxConcurrentChunks = 50;
this.embeddingMaxChunkLength = maximumChunkLength();
this.log(
`Initialized with ${this.model} - Max Size: ${this.embeddingMaxChunkLength}` +
(this.outputDimensions
? ` - Output Dimensions: ${this.outputDimensions}`
: " Assuming default output dimensions")View on GitHub (pinned to 3aec848f28)