Mintplex-Labs/anything-llm · critical · Error
No embedding base path was set.
Error message
No embedding base path was set.
What it means
Thrown by the LocalAiEmbedder constructor when EMBEDDING_BASE_PATH is unset. The class points the OpenAI SDK straight at your LocalAI instance's URL and sends batches of up to 50 chunks per request, so the base URL is the only mandatory value (LOCAL_AI_API_KEY is optional, defaulting to null).
Solutions
- Set EMBEDDING_BASE_PATH to the LocalAI OpenAI-compatible root, e.g. http://localhost:8080/v1
- If the deployment uses a reverse proxy, include the full prefix path
- Set LOCAL_AI_API_KEY if your LocalAI config requires an API key bearer token
- Also set EMBEDDING_MODEL_PREF (checked separately) and restart
Example fix
# before EMBEDDING_ENGINE=localai # after EMBEDDING_ENGINE=localai EMBEDDING_BASE_PATH=http://localhost:8080/v1 EMBEDDING_MODEL_PREF=bert-embeddings
Defensive patterns
Strategy: validation
Validate before calling
function assertLocalAiEmbedderConfigured() {
const missing = ["EMBEDDING_BASE_PATH", "EMBEDDING_MODEL_PREF"].filter(
(k) => !process.env[k]
);
if (missing.length) {
throw new Error(`LocalAI embedder misconfigured; missing: ${missing.join(", ")}`);
}
try { new URL(process.env.EMBEDDING_BASE_PATH); }
catch { throw new Error("EMBEDDING_BASE_PATH must be a valid URL (usually ends with /v1)"); }
}
assertLocalAiEmbedderConfigured(); Try / catch
try {
const embedder = new LocalAiEmbedder();
} catch (e) {
if (e.message === "No embedding base path was set.") {
// prompt for the LocalAI URL (default http://localhost:8080/v1); no retry
}
throw e;
} Prevention
- Record the LocalAI URL including any /v1 prefix or reverse-proxy subpath
- Validate URL shape in the settings form before saving
- Set LOCAL_AI_API_KEY in the same pass when the instance enforces auth
When it happens
Trigger: Picking LocalAI as the embedding engine without a base path; EMBEDDING_ENGINE=localai in env but EMBEDDING_BASE_PATH absent; LocalAI running on a custom port that was never recorded; .env changes not followed by a restart.
Common situations: Self-hosting LocalAI via Docker and mapping it to a non-default port; reversing proxy LocalAI behind a subpath and forgetting to include it in the URL.
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
- GenericOpenAI must have a valid base path to use for the…
- LiteLLM must have a valid base path to use for the api.
- No embedding base path was set.
- No embedding base path was set.
- No embedding model was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/104e73503fceacae.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/EmbeddingEngines/localAi/index.js:10
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.outputDimensionsView on GitHub (pinned to 3aec848f28)