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.outputDimensions

View on GitHub (pinned to 526360e320)

Solutions

  1. Set EMBEDDING_BASE_PATH to the LocalAI server root, e.g. http://localhost:8080/v1
  2. Confirm the LocalAI server is reachable at that URL
  3. 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

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


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/104e73503fceacae. Report an issue: GitHub.