Mintplex-Labs/anything-llm · critical
No embedding base path was set.
Error message
No embedding base path was set.
What it means
Thrown by the OllamaEmbedder constructor when EMBEDDING_BASE_PATH is unset. Unlike the OpenAI-SDK engines, this class talks to Ollama natively (the 'ollama' package) using that URL, requires an explicit model (EMBEDDING_MODEL_PREF is checked next), and sizes batches from OLLAMA_EMBEDDING_BATCH_SIZE (default 1). Without the base path it cannot locate your Ollama daemon (typically http://127.0.0.1:11434).
Solutions
- Set EMBEDDING_BASE_PATH to your Ollama URL, e.g. http://127.0.0.1:11434
- If AnythingLLM runs in Docker and Ollama on the host, use http://host.docker.internal:11434 (add extra_hosts on Linux)
- Also set EMBEDDING_MODEL_PREF to a pulled embedding model (e.g. nomic-embed-text) — checked by the next guard
- Optionally set OLLAMA_EMBEDDING_BATCH_SIZE above 1 for throughput once it works
- Restart the server after saving
Example fix
# before EMBEDDING_ENGINE=ollama # after (docker -> host ollama) EMBEDDING_ENGINE=ollama EMBEDDING_BASE_PATH=http://host.docker.internal:11434 EMBEDDING_MODEL_PREF=nomic-embed-text OLLAMA_EMBEDDING_BATCH_SIZE=32
Defensive patterns
Strategy: validation
Validate before calling
function assertOllamaEmbedderConfigured() {
const missing = ["EMBEDDING_BASE_PATH", "EMBEDDING_MODEL_PREF"].filter(
(k) => !process.env[k]
);
if (missing.length) {
throw new Error(`Ollama 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, e.g. http://127.0.0.1:11434"); }
}
assertOllamaEmbedderConfigured(); Try / catch
try {
const { OllamaEmbedder } = require("./server/utils/EmbeddingEngines/ollama");
const embedder = new OllamaEmbedder();
} catch (e) {
if (e.message === "No embedding base path was set.") {
// set EMBEDDING_BASE_PATH (docker->host: http://host.docker.internal:11434); no retry
}
throw e;
} Prevention
- In Docker, point EMBEDDING_BASE_PATH at host.docker.internal (not localhost) when Ollama runs on the host
- Ensure `ollama pull nomic-embed-text` (or your embedding model) finished before configuring
- Set OLLAMA_EMBEDDING_BATCH_SIZE > 1 deliberately — the conservative default is 1
When it happens
Trigger: Selecting Ollama as the embedding engine without a base path; Ollama bound to a custom host/port (OLLAMA_HOST) that was never entered; remote Ollama instances where the URL field was skipped; env var set but the process not restarted.
Common situations: Docker deployments where 'localhost' points inside the container — the fix requires host.docker.internal; Ollama behind HTTPS reverse proxies with the wrong URL recorded.
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.
- 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 Lemonade API Base Path was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/11cd01d1eab4dbb7.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/EmbeddingEngines/ollama/index.js:11
const {
maximumChunkLength,
reportEmbeddingProgress,
} = require("../../helpers");
const { Ollama } = require("ollama");
const { OllamaAILLM } = require("../../AiProviders/ollama");
class OllamaEmbedder {
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 = "OllamaEmbedder";
this.basePath = process.env.EMBEDDING_BASE_PATH;
this.model = process.env.EMBEDDING_MODEL_PREF;
this.maxConcurrentChunks = process.env.OLLAMA_EMBEDDING_BATCH_SIZE
? Number(process.env.OLLAMA_EMBEDDING_BATCH_SIZE)
: 1;
this.embeddingMaxChunkLength = maximumChunkLength();
this.authToken = process.env.OLLAMA_AUTH_TOKEN;
const headers = this.authToken
? { Authorization: `Bearer ${this.authToken}` }
: {};
this.client = new Ollama({
host: this.basePath,
headers,View on GitHub (pinned to 3aec848f28)