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 EMBEDDING_BASE_PATH is unset. The path is normalized through parseLMStudioBasePath and handed to the OpenAI SDK as baseURL for LM Studio's local OpenAI-compatible server. Without it the embedder cannot know where your LM Studio instance listens (default http://localhost:1234).

Solutions

  1. In LM Studio, start the server (Developer tab) and confirm the port (default 1234)
  2. Set EMBEDDING_BASE_PATH to that address, e.g. http://localhost:1234/v1
  3. Also set EMBEDDING_MODEL_PREF — this constructor throws separately if it is missing
  4. Restart the backend after saving

Example fix

# before
EMBEDDING_ENGINE=lmstudio

# after
EMBEDDING_ENGINE=lmstudio
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 assertLMStudioEmbedderConfigured() {
  const missing = ["EMBEDDING_BASE_PATH", "EMBEDDING_MODEL_PREF"].filter(
    (k) => !process.env[k]
  );
  if (missing.length) {
    throw new Error(`LMStudio embedder misconfigured; missing: ${missing.join(", ")}`);
  }
}
assertLMStudioEmbedderConfigured();

Try / catch

try {
  const embedder = new LMStudioEmbedder();
} catch (e) {
  if (e.message === "No embedding base path was set.") {
    // default hint: http://localhost:1234/v1 — start LM Studio's server first
  }
  throw e;
}

Prevention

When it happens

Trigger: Selecting LMStudio as the embedding engine without filling the base path; EMBEDDING_ENGINE=lmstudio set in env but EMBEDDING_BASE_PATH missing; LM Studio started on a non-default port that was never recorded; variable set only inside the container while the process reads another environment.

Common situations: Local-only setups using LM Studio's local server; port changed from 1234 in LM Studio settings and the field left stale or empty.

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/3586982643a3a5df. Report an issue: GitHub.

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