{"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/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/EmbeddingEngines/localAi/index.js#L1-L28","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set EMBEDDING_BASE_PATH to the LocalAI server root, e.g. http://localhost:8080/v1","Confirm the LocalAI server is reachable at that URL","Reload AnythingLLM env after the .env edit"],"exampleFix":"// before\n// EMBEDDING_BASE_PATH unset\n\n// after\nEMBEDDING_BASE_PATH=http://localhost:8080/v1\nEMBEDDING_MODEL_PREF=text-embedding-bge-small-en\nLOCAL_AI_API_KEY=...","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 LocalAI.');\n}","typeGuard":"function isLocalAIBasePath(v) {\n  return typeof v === 'string' && /^https?:\\/\\//.test(v);\n}","tryCatchPattern":null,"preventionTips":["Set EMBEDDING_BASE_PATH to the LocalAI /v1 root.","Validate env at boot for the chosen engine.","Use the in-container URL when LocalAI runs alongside AnythingLLM in Docker."],"tags":["localai","embedding","config","env","constructor"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}