{"record":{"id":"c5656baf6e995de2","repo":"Mintplex-Labs/anything-llm","slug":"omlx-must-have-a-valid-model-set-c5656b","errorCode":null,"errorMessage":"OMLX must have a valid model set.","messagePattern":"OMLX must have a valid model set\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"server/utils/agents/aibitat/providers/omlx.js","lineNumber":24,"sourceCode":"const { RetryError } = require(\"../error.js\");\nconst { parseOMLXBasePath } = require(\"../../../AiProviders/omlx/index.js\");\n\n/**\n * The agent provider for OMLX.\n * OMLX is OpenAI-compatible and supports native tool calling, falling back\n * to the UnTooled prompt-based approach when disabled via env.\n */\nclass OMLXProvider extends InheritMultiple([Provider, UnTooled]) {\n  model;\n\n  /**\n   * @param {{model?: string}} config\n   */\n  constructor(config = {}) {\n    super();\n    this.providerTag = \"omlx\";\n    const model = config?.model || process.env.OMLX_LLM_MODEL_PREF;\n    if (!model) throw new Error(\"OMLX must have a valid model set.\");\n\n    const client = new OpenAI({\n      baseURL: parseOMLXBasePath(process.env.OMLX_LLM_BASE_PATH),\n      apiKey: process.env.OMLX_LLM_API_KEY || null,\n    });\n\n    this._client = client;\n    this.model = model;\n    this.verbose = true;\n  }\n\n  get client() {\n    return this._client;\n  }\n\n  get supportsAgentStreaming() {\n    return true;\n  }","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/agents/aibitat/providers/omlx.js#L6-L42","documentation":"OMLXProvider's constructor (omlx.js:18-24) requires a model id from either config.model or the OMLX_LLM_MODEL_PREF environment variable and throws this if neither is set. OMLX (AMD's Omnissa/OMLX runtime) is reached via an OpenAI-compatible client, so the agent needs the target model id.","triggerScenarios":"Instantiating OMLXProvider with no config.model while OMLX_LLM_MODEL_PREF is unset in the environment.","commonSituations":"Fresh OMLX setup without setting the model preference, an env var that was renamed, or a deployment that forgot to port OMLX_LLM_MODEL_PREF into the container env.","solutions":["Set OMLX_LLM_MODEL_PREF in .env to a model served by the OMLX runtime.","Or pass { model: \"<id>\" } in the provider config.","Confirm OMLX_LLM_BASE_PATH points at the running OMLX server and the model is loaded.","If a key is required, set OMLX_LLM_API_KEY as well."],"exampleFix":"// before (env missing)\n// OMLX_LLM_MODEL_PREF=\nconst p = new OMLXProvider();\n\n// after (.env)\n// OMLX_LLM_MODEL_PREF=Llama-3.1-8B-Instruct\nconst p = new OMLXProvider();","handlingStrategy":"validation","validationCode":"const model = config?.model || process.env.OMLX_LLM_MODEL_PREF;\nif (!model)\n  throw new Error(\n    \"Set OMLX_LLM_MODEL_PREF (or pass config.model) before creating OMLXProvider.\"\n  );","typeGuard":"/** @param {unknown} v @returns {v is string} */\nfunction isNonEmptyString(v) {\n  return typeof v === \"string\" && v.trim().length > 0;\n}","tryCatchPattern":"try {\n  return new OMLXProvider(config);\n} catch (e) {\n  if (/valid model set/.test(e.message)) {\n    throw new Error(\"Please choose an OMLX model before starting the agent.\");\n  }\n  throw e;\n}","preventionTips":["Set OMLX_LLM_MODEL_PREF and OMLX_LLM_BASE_PATH together in .env.","Confirm the model is loaded by the OMLX runtime before use.","Validate env at boot so the failure is surfaced early and clearly.","Document the exact model ids the runtime exposes."],"tags":["omlx","config","env","model-selection","local-llm"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}