{"record":{"id":"3586982643a3a5df","repo":"Mintplex-Labs/anything-llm","slug":"no-embedding-base-path-was-set","errorCode":null,"errorMessage":"No embedding base path was set.","messagePattern":"No embedding base path was set\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"server/utils/EmbeddingEngines/lmstudio/index.js","lineNumber":10,"sourceCode":"const { parseLMStudioBasePath } = require(\"../../AiProviders/lmStudio\");\nconst {\n  maximumChunkLength,\n  reportEmbeddingProgress,\n} = require(\"../../helpers\");\n\nclass LMStudioEmbedder {\n  constructor() {\n    if (!process.env.EMBEDDING_BASE_PATH)\n      throw new Error(\"No embedding base path was set.\");\n    if (!process.env.EMBEDDING_MODEL_PREF)\n      throw new Error(\"No embedding model was set.\");\n\n    const apiKey = process.env.LMSTUDIO_AUTH_TOKEN ?? null;\n    this.className = \"LMStudioEmbedder\";\n    const { OpenAI: OpenAIApi } = require(\"openai\");\n    this.lmstudio = new OpenAIApi({\n      baseURL: parseLMStudioBasePath(process.env.EMBEDDING_BASE_PATH),\n      apiKey,\n    });\n    this.model = process.env.EMBEDDING_MODEL_PREF;\n\n    // Limit of how many strings we can process in a single pass to stay with resource or network limits\n    this.maxConcurrentChunks = 1;\n    this.embeddingMaxChunkLength = maximumChunkLength();\n  }\n\n  log(text, ...args) {","sourceCodeStart":1,"sourceCodeEnd":28,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/EmbeddingEngines/lmstudio/index.js#L1-L28","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set EMBEDDING_BASE_PATH to LMStudio's local server URL, e.g. EMBEDDING_BASE_PATH=http://localhost:1234/v1","Ensure LMStudio's local server is actually started (the tray app 'Start Server')","Restart AnythingLLM so the constructor re-reads the env"],"exampleFix":"// before\n// EMBEDDING_BASE_PATH unset\n\n// after\n// .env\nEMBEDDING_BASE_PATH=http://localhost:1234/v1\nEMBEDDING_MODEL_PREF=text-embedding-nomic-embed-text-v1.5","handlingStrategy":"validation","validationCode":"function hasEmbeddingBasePath(env = process.env) {\n  return typeof env.EMBEDDING_BASE_PATH === 'string' &&\n         env.EMBEDDING_BASE_PATH.trim().length > 0;\n}\nif (!hasEmbeddingBasePath()) {\n  throw new Error('Missing EMBEDDING_BASE_PATH for LMStudio.');\n}","typeGuard":"function isLMStudioBasePath(v) {\n  return typeof v === 'string' && /http:\\/\\/(localhost|127\\.0\\.0\\.1|host\\.docker\\.internal)(:\\d+)?\\/v1/.test(v);\n}","tryCatchPattern":null,"preventionTips":["Start the LMStudio server and load a model before enabling the engine in AnythingLLM.","Use host.docker.internal in containerized setups, not localhost.","Reload env after every .env edit."],"tags":["lmstudio","embedding","config","env","constructor"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}