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

  1. Set EMBEDDING_BASE_PATH to your Ollama URL, e.g. http://127.0.0.1:11434
  2. If AnythingLLM runs in Docker and Ollama on the host, use http://host.docker.internal:11434 (add extra_hosts on Linux)
  3. Also set EMBEDDING_MODEL_PREF to a pulled embedding model (e.g. nomic-embed-text) — checked by the next guard
  4. Optionally set OLLAMA_EMBEDDING_BATCH_SIZE above 1 for throughput once it works
  5. 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

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


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)