{"record":{"id":"1ddd3894db5b9232","repo":"Mintplex-Labs/anything-llm","slug":"no-omlx-api-base-path-was-set","errorCode":null,"errorMessage":"No OMLX API Base Path was set.","messagePattern":"No OMLX API Base Path was set\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"server/utils/AiProviders/omlx/index.js","lineNumber":21,"sourceCode":"  handleDefaultStreamResponseV2,\n  formatChatHistory,\n} = require(\"../../helpers/chat/responses\");\nconst {\n  LLMPerformanceMonitor,\n} = require(\"../../helpers/chat/LLMPerformanceMonitor\");\nconst { OpenAI: OpenAIApi } = require(\"openai\");\n\n/**\n * OMLX (oMLX) is an OpenAI-compatible MLX inference server for Apple Silicon.\n * https://github.com/jundot/omlx\n */\nclass OMLXLLM {\n  /** @see OMLXLLM.cacheContextWindows */\n  static modelContextWindows = {};\n\n  constructor(embedder = null, modelPreference = null) {\n    if (!process.env.OMLX_LLM_BASE_PATH)\n      throw new Error(\"No OMLX API Base Path was set.\");\n\n    this.className = \"OMLXLLM\";\n    this.omlx = new OpenAIApi({\n      baseURL: parseOMLXBasePath(process.env.OMLX_LLM_BASE_PATH),\n      apiKey: process.env.OMLX_LLM_API_KEY || null,\n    });\n\n    this.model = modelPreference || process.env.OMLX_LLM_MODEL_PREF;\n    if (!this.model) throw new Error(\"OMLX must have a valid model set.\");\n\n    this.embedder = embedder ?? new NativeEmbedder();\n    this.defaultTemp = 0.7;\n\n    // Lazy load the limits to avoid blocking the main thread on cacheContextWindows\n    this.limits = null;\n\n    OMLXLLM.cacheContextWindows(true);\n    this.#log(`initialized with model: ${this.model}`);","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/AiProviders/omlx/index.js#L3-L39","documentation":"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.","triggerScenarios":"Instantiating OMLXLLM when process.env.OMLX_LLM_BASE_PATH is undefined or empty.","commonSituations":".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.","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."],"exampleFix":"# before\n# (OMLX_LLM_BASE_PATH unset)\n\n# after - .env\nOMLX_LLM_BASE_PATH=http://127.0.0.1:8080","handlingStrategy":"validation","validationCode":"if (!process.env.OMLX_LLM_BASE_PATH || !process.env.OMLX_LLM_BASE_PATH.trim())\n  throw new Error('OMLX_LLM_BASE_PATH must be set before starting OMLXLLM.');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["omlx","configuration","env"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}