{"record":{"id":"104e73503fceacae","repo":"Mintplex-Labs/anything-llm","slug":"no-embedding-base-path-was-set-104e73","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/localAi/index.js","lineNumber":10,"sourceCode":"const {\n  toChunks,\n  maximumChunkLength,\n  reportEmbeddingProgress,\n} = require(\"../../helpers\");\n\nclass LocalAiEmbedder {\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    this.className = \"LocalAiEmbedder\";\n    const { OpenAI: OpenAIApi } = require(\"openai\");\n    this.model = process.env.EMBEDDING_MODEL_PREF;\n    this.openai = new OpenAIApi({\n      baseURL: process.env.EMBEDDING_BASE_PATH,\n      apiKey: process.env.LOCAL_AI_API_KEY ?? null,\n    });\n\n    // Limit of how many strings we can process in a single pass to stay with resource or network limits\n    this.maxConcurrentChunks = 50;\n    this.embeddingMaxChunkLength = maximumChunkLength();\n\n    this.log(\n      `Initialized with ${this.model} - Max Size: ${this.embeddingMaxChunkLength}` +\n        (this.outputDimensions","sourceCodeStart":1,"sourceCodeEnd":28,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/EmbeddingEngines/localAi/index.js#L1-L28","documentation":"Thrown by the LocalAiEmbedder constructor when EMBEDDING_BASE_PATH is unset. The class points the OpenAI SDK straight at your LocalAI instance's URL and sends batches of up to 50 chunks per request, so the base URL is the only mandatory value (LOCAL_AI_API_KEY is optional, defaulting to null).","triggerScenarios":"Picking LocalAI as the embedding engine without a base path; EMBEDDING_ENGINE=localai in env but EMBEDDING_BASE_PATH absent; LocalAI running on a custom port that was never recorded; .env changes not followed by a restart.","commonSituations":"Self-hosting LocalAI via Docker and mapping it to a non-default port; reversing proxy LocalAI behind a subpath and forgetting to include it in the URL.","solutions":["Set EMBEDDING_BASE_PATH to the LocalAI OpenAI-compatible root, e.g. http://localhost:8080/v1","If the deployment uses a reverse proxy, include the full prefix path","Set LOCAL_AI_API_KEY if your LocalAI config requires an API key bearer token","Also set EMBEDDING_MODEL_PREF (checked separately) and restart"],"exampleFix":"# before\nEMBEDDING_ENGINE=localai\n\n# after\nEMBEDDING_ENGINE=localai\nEMBEDDING_BASE_PATH=http://localhost:8080/v1\nEMBEDDING_MODEL_PREF=bert-embeddings","handlingStrategy":"validation","validationCode":"function assertLocalAiEmbedderConfigured() {\n  const missing = [\"EMBEDDING_BASE_PATH\", \"EMBEDDING_MODEL_PREF\"].filter(\n    (k) => !process.env[k]\n  );\n  if (missing.length) {\n    throw new Error(`LocalAI embedder misconfigured; missing: ${missing.join(\", \")}`);\n  }\n  try { new URL(process.env.EMBEDDING_BASE_PATH); }\n  catch { throw new Error(\"EMBEDDING_BASE_PATH must be a valid URL (usually ends with /v1)\"); }\n}\nassertLocalAiEmbedderConfigured();","typeGuard":null,"tryCatchPattern":"try {\n  const embedder = new LocalAiEmbedder();\n} catch (e) {\n  if (e.message === \"No embedding base path was set.\") {\n    // prompt for the LocalAI URL (default http://localhost:8080/v1); no retry\n  }\n  throw e;\n}","preventionTips":["Record the LocalAI URL including any /v1 prefix or reverse-proxy subpath","Validate URL shape in the settings form before saving","Set LOCAL_AI_API_KEY in the same pass when the instance enforces auth"],"tags":["localai","self-hosted","env-var","configuration","base-url","constructor"],"backgroundTag":"missing-env-var","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}