Mintplex-Labs/anything-llm · error · Error

No Ollama Base Path was set.

Error message

No Ollama Base Path was set.

What it means

Constructor guard in OllamaAILLM: the OLLAMA_BASE_PATH environment variable is unset, so there is no URL to point the Ollama client at and provider instantiation fails before any model lookup or chat.

Solutions

  1. Set the Ollama base path (e.g. http://127.0.0.1:11434) in provider settings.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at provider construction when no Ollama base path is configured.

Common situations: Ollama selected without a base path.


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/c8bd50ff2ed9693e. Report an issue: GitHub.

Appendix: 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 3aec848f28)