Mintplex-Labs/anything-llm · critical · Error
No Ollama Base Path was set.
Error message
No Ollama Base Path was set.
What it means
Synchronous constructor guard. OllamaAILLM cannot be instantiated unless OLLAMA_BASE_PATH is set; the value is required to build the underlying Ollama client (host) used for every subsequent call. Thrown at 'new OllamaAILLM(...)' before any network activity.
Source
Thrown at server/utils/AiProviders/ollama/index.js:20
writeResponseChunk,
clientAbortedHandler,
formatChatHistory,
} = require("../../helpers/chat/responses");
const { NativeEmbedder } = require("../../EmbeddingEngines/native");
const {
LLMPerformanceMonitor,
} = require("../../helpers/chat/LLMPerformanceMonitor");
const { Ollama } = require("ollama");
const { v4: uuidv4 } = require("uuid");
// Docs: https://github.com/jmorganca/ollama/blob/main/docs/api.md
class OllamaAILLM {
/** @see OllamaAILLM.cacheContextWindows */
static modelContextWindows = {};
constructor(embedder = null, modelPreference = null) {
if (!process.env.OLLAMA_BASE_PATH)
throw new Error("No Ollama Base Path was set.");
this.className = "OllamaAILLM";
this.authToken = process.env.OLLAMA_AUTH_TOKEN;
this.basePath = process.env.OLLAMA_BASE_PATH;
this.model = modelPreference || process.env.OLLAMA_MODEL_PREF;
this.keepAlive = process.env.OLLAMA_KEEP_ALIVE_TIMEOUT
? Number(process.env.OLLAMA_KEEP_ALIVE_TIMEOUT)
: 300; // Default 5-minute timeout for Ollama model loading.
const headers = this.authToken
? { Authorization: `Bearer ${this.authToken}` }
: {};
this.client = new Ollama({
host: this.basePath,
headers: headers,
fetch: OllamaAILLM.applyOllamaFetch(),
});
this.embedder = embedder ?? new NativeEmbedder();View on GitHub (pinned to 526360e320)
Solutions
- Set OLLAMA_BASE_PATH to the Ollama API origin (e.g. http://127.0.0.1:11434) in .env.
- Restart the AnythingLLM server so the new env is picked up.
- Confirm via the UI: Settings > LLM Provider > Ollama shows a non-empty base path.
- If using Docker, verify the env var is passed to the container and the Ollama address is reachable from inside it.
Example fix
# before # (OLLAMA_BASE_PATH unset) # after - .env OLLAMA_BASE_PATH=http://127.0.0.1:11434
Defensive patterns
Strategy: validation
Validate before calling
if (!process.env.OLLAMA_BASE_PATH || !process.env.OLLAMA_BASE_PATH.trim())
throw new Error('OLLAMA_BASE_PATH must be set before starting OllamaAILLM.'); Prevention
- Validate required env vars at boot and fail fast with a clear message.
- Use the AnythingLLM UI provider settings to persist OLLAMA_BASE_PATH rather than relying on manual edits.
- Include the var in docker-compose / container env so it is always present.
When it happens
Trigger: Instantiating OllamaAILLM (typically by the provider factory during a chat request or at boot) when process.env.OLLAMA_BASE_PATH is undefined or empty string.
Common situations: .env file missing or not loaded; var typo'd as OLLAMA_HOST or OLLAMA_BASE_URL; fresh deployment where the Ollama provider was selected in the UI but the env was never written; docker-compose without the var passed through.
Related errors
- No Minimax API key was set.
- No Mistral API key was set.
- No Moonshot AI API key was set.
- No Novita API key was set.
- No NVIDIA NIM API Base Path was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/c8bd50ff2ed9693e.
Report an issue: GitHub.