Mintplex-Labs/anything-llm · critical · Error
No LocalAI Base Path was set.
Error message
No LocalAI Base Path was set.
What it means
Thrown by the LocalAiLLM constructor when LOCAL_AI_BASE_PATH is not set. The base path is the URL of the LocalAI server instance. There is no constructor-parameter fallback — it must come from the environment. The OpenAI-compatible client is initialized with this base path and an optional API key from LOCAL_AI_API_KEY.
Source
Thrown at server/utils/AiProviders/localAi/index.js:13
const { NativeEmbedder } = require("../../EmbeddingEngines/native");
const {
LLMPerformanceMonitor,
} = require("../../helpers/chat/LLMPerformanceMonitor");
const {
handleDefaultStreamResponseV2,
formatChatHistory,
} = require("../../helpers/chat/responses");
class LocalAiLLM {
constructor(embedder = null, modelPreference = null) {
if (!process.env.LOCAL_AI_BASE_PATH)
throw new Error("No LocalAI Base Path was set.");
this.className = "LocalAiLLM";
const { OpenAI: OpenAIApi } = require("openai");
this.openai = new OpenAIApi({
baseURL: process.env.LOCAL_AI_BASE_PATH,
apiKey: process.env.LOCAL_AI_API_KEY ?? null,
});
this.model = modelPreference || process.env.LOCAL_AI_MODEL_PREF;
this.limits = {
history: this.promptWindowLimit() * 0.15,
system: this.promptWindowLimit() * 0.15,
user: this.promptWindowLimit() * 0.7,
};
this.embedder = embedder ?? new NativeEmbedder();
this.defaultTemp = 0.7;
}
View on GitHub (pinned to 526360e320)
Solutions
- Set LOCAL_AI_BASE_PATH in .env to your LocalAI server URL (e.g. 'http://localhost:8080/v1') and restart.
- Verify the LocalAI server is running and serving models at that endpoint.
- If using Docker, use host.docker.internal instead of localhost.
Example fix
// before: .env # LOCAL_AI_BASE_PATH='http://localhost:8080/v1' // after LOCAL_AI_BASE_PATH='http://localhost:8080/v1'
Defensive patterns
Strategy: validation
Validate before calling
function validateLocalAIConfig() {
if (!process.env.LOCAL_AI_BASE_PATH) {
throw new Error(
'LOCAL_AI_BASE_PATH is not set. Configure it in .env (e.g. http://localhost:8080/v1).'
);
}
return process.env.LOCAL_AI_BASE_PATH;
}
validateLocalAIConfig(); Try / catch
try {
const llm = new LocalAiLLM(embedder, model);
} catch (e) {
if (e.message.includes('Base Path')) {
console.error('Set LOCAL_AI_BASE_PATH in .env to your LocalAI server URL.');
return null;
}
throw e;
} Prevention
- Verify the LocalAI server is running and serving models before starting AnythingLLM.
- Use host.docker.internal in Docker deployments.
- Add a startup validator that checks LOCAL_AI_BASE_PATH for the selected provider.
When it happens
Trigger: Instantiating `new LocalAiLLM(embedder, model)` (via getLLMProvider('localai')) when process.env.LOCAL_AI_BASE_PATH is undefined or empty. The check fires before any client initialization.
Common situations: LocalAI provider was selected in settings but .env was never updated. Docker deployment where .env.example was copied without uncommenting LOCAL_AI_BASE_PATH. The LocalAI server moved to a different host/port and .env wasn't updated.
Related errors
- No Lemonade API Base Path was set.
- LiteLLM must have a valid base path to use for the api.
- No LMStudio API Base Path was set.
- KoboldCPP must have a valid model set.
- No Lemonade Model Pref was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/c1db983ebc051b39.
Report an issue: GitHub.