Mintplex-Labs/anything-llm · critical · Error
No OMLX API Base Path was set.
Error message
No OMLX API Base Path was set.
What it means
Synchronous constructor guard. OMLXLLM cannot be instantiated unless OMLX_LLM_BASE_PATH is set; the value is required to build the OpenAI-compatible client pointed at the oMLX server. Thrown at 'new OMLXLLM(...)' before any network activity.
Source
Thrown at server/utils/AiProviders/omlx/index.js:21
handleDefaultStreamResponseV2,
formatChatHistory,
} = require("../../helpers/chat/responses");
const {
LLMPerformanceMonitor,
} = require("../../helpers/chat/LLMPerformanceMonitor");
const { OpenAI: OpenAIApi } = require("openai");
/**
* OMLX (oMLX) is an OpenAI-compatible MLX inference server for Apple Silicon.
* https://github.com/jundot/omlx
*/
class OMLXLLM {
/** @see OMLXLLM.cacheContextWindows */
static modelContextWindows = {};
constructor(embedder = null, modelPreference = null) {
if (!process.env.OMLX_LLM_BASE_PATH)
throw new Error("No OMLX API Base Path was set.");
this.className = "OMLXLLM";
this.omlx = new OpenAIApi({
baseURL: parseOMLXBasePath(process.env.OMLX_LLM_BASE_PATH),
apiKey: process.env.OMLX_LLM_API_KEY || null,
});
this.model = modelPreference || process.env.OMLX_LLM_MODEL_PREF;
if (!this.model) throw new Error("OMLX must have a valid model set.");
this.embedder = embedder ?? new NativeEmbedder();
this.defaultTemp = 0.7;
// Lazy load the limits to avoid blocking the main thread on cacheContextWindows
this.limits = null;
OMLXLLM.cacheContextWindows(true);
this.#log(`initialized with model: ${this.model}`);View on GitHub (pinned to 526360e320)
Solutions
- Set OMLX_LLM_BASE_PATH to the oMLX server origin (e.g. http://127.0.0.1:8080) in .env.
- Restart the AnythingLLM server after saving.
- Confirm the oMLX server is reachable at that origin.
- If using the UI provider settings, ensure the base path field is saved.
Example fix
# before # (OMLX_LLM_BASE_PATH unset) # after - .env OMLX_LLM_BASE_PATH=http://127.0.0.1:8080
Defensive patterns
Strategy: validation
Validate before calling
if (!process.env.OMLX_LLM_BASE_PATH || !process.env.OMLX_LLM_BASE_PATH.trim())
throw new Error('OMLX_LLM_BASE_PATH must be set before starting OMLXLLM.'); Prevention
- Validate OMLX_LLM_BASE_PATH at boot and fail fast.
- Save the provider config through the UI so it persists.
- Confirm the oMLX server is reachable at the configured origin.
When it happens
Trigger: Instantiating OMLXLLM when process.env.OMLX_LLM_BASE_PATH is undefined or empty.
Common situations: .env missing the var or misspelled (e.g. OMLX_BASE_PATH); oMLX provider selected in UI but config never written; fresh deploy; Apple Silicon machine where the oMLX server URL changed.
Related errors
- No Minimax API key was set.
- No Mistral API key was set.
- No Moonshot AI API key was set.
- No Novita API key was set.
- No NVIDIA NIM API Base Path was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/1ddd3894db5b9232.
Report an issue: GitHub.