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 LMStudioEmbedder constructor when process.env.EMBEDDING_BASE_PATH is falsy. LMStudio exposes a local OpenAI-compatible server and this library requires its origin to build the openai SDK client (the value is further normalized by parseLMStudioBasePath). Without it the client has no baseURL, so construction aborts immediately.

Source

Thrown at server/utils/EmbeddingEngines/lmstudio/index.js:10

const { parseLMStudioBasePath } = require("../../AiProviders/lmStudio");
const {
  maximumChunkLength,
  reportEmbeddingProgress,
} = require("../../helpers");

class LMStudioEmbedder {
  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.");

    const apiKey = process.env.LMSTUDIO_AUTH_TOKEN ?? null;
    this.className = "LMStudioEmbedder";
    const { OpenAI: OpenAIApi } = require("openai");
    this.lmstudio = new OpenAIApi({
      baseURL: parseLMStudioBasePath(process.env.EMBEDDING_BASE_PATH),
      apiKey,
    });
    this.model = process.env.EMBEDDING_MODEL_PREF;

    // Limit of how many strings we can process in a single pass to stay with resource or network limits
    this.maxConcurrentChunks = 1;
    this.embeddingMaxChunkLength = maximumChunkLength();
  }

  log(text, ...args) {

View on GitHub (pinned to 526360e320)

Solutions

  1. Set EMBEDDING_BASE_PATH to LMStudio's local server URL, e.g. EMBEDDING_BASE_PATH=http://localhost:1234/v1
  2. Ensure LMStudio's local server is actually started (the tray app 'Start Server')
  3. Restart AnythingLLM so the constructor re-reads the env

Example fix

// before
// EMBEDDING_BASE_PATH unset

// after
// .env
EMBEDDING_BASE_PATH=http://localhost:1234/v1
EMBEDDING_MODEL_PREF=text-embedding-nomic-embed-text-v1.5
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 LMStudio.');
}

Type guard

function isLMStudioBasePath(v) {
  return typeof v === 'string' && /http:\/\/(localhost|127\.0\.0\.1|host\.docker\.internal)(:\d+)?\/v1/.test(v);
}

Prevention

When it happens

Trigger: Selecting the LMStudio embedding engine in AnythingLLM while EMBEDDING_BASE_PATH is unset/empty; instantiating `new LMStudioEmbedder()` in a test or boot path before the env is loaded. The check on line 9 runs before the openai client is built on line 17.

Common situations: First-time LMStudio setup where the user set the model but not the base path; LMStudio was started on a non-default port (e.g. http://localhost:1234/v1) and the env was never updated; .env not reloaded after edit; shared EMBEDDING_BASE_PATH reused across engines with conflicting formats.

Related errors


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