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 process.env.EMBEDDING_BASE_PATH is falsy. LocalAI is a self-hosted OpenAI-compatible server and the embedder needs its origin to construct the openai SDK client with baseURL. The guard on line 9 runs before the client is built on line 14, failing fast instead of producing a client pointing at the SDK default.
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 526360e320)
Solutions
- Set EMBEDDING_BASE_PATH to the LocalAI server root, e.g. http://localhost:8080/v1
- Confirm the LocalAI server is reachable at that URL
- Reload AnythingLLM env after the .env edit
Example fix
// before // EMBEDDING_BASE_PATH unset // after EMBEDDING_BASE_PATH=http://localhost:8080/v1 EMBEDDING_MODEL_PREF=text-embedding-bge-small-en LOCAL_AI_API_KEY=...
Defensive patterns
Strategy: validation
Validate before calling
function hasEmbeddingBasePath(env = process.env) {
return typeof env.EMBEDDING_BASE_PATH === 'string' &&
env.EMBEDDING_BASE_PATH.trim().length > 0;
}
if (!hasEmbeddingBasePath()) {
throw new Error('Missing EMBEDDING_BASE_PATH for LocalAI.');
} Type guard
function isLocalAIBasePath(v) {
return typeof v === 'string' && /^https?:\/\//.test(v);
} Prevention
- Set EMBEDDING_BASE_PATH to the LocalAI /v1 root.
- Validate env at boot for the chosen engine.
- Use the in-container URL when LocalAI runs alongside AnythingLLM in Docker.
When it happens
Trigger: Selecting the LocalAI embedding engine while EMBEDDING_BASE_PATH is unset/empty; constructing `new LocalAiEmbedder()` before env load. Identical pattern to the LMStudio/Ollama base-path guards.
Common situations: Fresh LocalAI install where the server URL was not added to .env; LocalAI moved to a different host/port; env var typo; Docker deployment where the inter-service URL differs from the browser URL.
Related errors
- No embedding model 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/104e73503fceacae.
Report an issue: GitHub.