Mintplex-Labs/anything-llm · critical · Error
OMLX must have a valid model set.
Error message
OMLX must have a valid model set.
What it means
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.
Source
Thrown at server/utils/agents/aibitat/providers/omlx.js:24
const { RetryError } = require("../error.js");
const { parseOMLXBasePath } = require("../../../AiProviders/omlx/index.js");
/**
* The agent provider for OMLX.
* OMLX is OpenAI-compatible and supports native tool calling, falling back
* to the UnTooled prompt-based approach when disabled via env.
*/
class OMLXProvider extends InheritMultiple([Provider, UnTooled]) {
model;
/**
* @param {{model?: string}} config
*/
constructor(config = {}) {
super();
this.providerTag = "omlx";
const model = config?.model || process.env.OMLX_LLM_MODEL_PREF;
if (!model) throw new Error("OMLX must have a valid model set.");
const client = new OpenAI({
baseURL: parseOMLXBasePath(process.env.OMLX_LLM_BASE_PATH),
apiKey: process.env.OMLX_LLM_API_KEY || null,
});
this._client = client;
this.model = model;
this.verbose = true;
}
get client() {
return this._client;
}
get supportsAgentStreaming() {
return true;
}View on GitHub (pinned to 526360e320)
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.
Example fix
// before (env missing) // OMLX_LLM_MODEL_PREF= const p = new OMLXProvider(); // after (.env) // OMLX_LLM_MODEL_PREF=Llama-3.1-8B-Instruct const p = new OMLXProvider();
Defensive patterns
Strategy: validation
Validate before calling
const model = config?.model || process.env.OMLX_LLM_MODEL_PREF;
if (!model)
throw new Error(
"Set OMLX_LLM_MODEL_PREF (or pass config.model) before creating OMLXProvider."
); Type guard
/** @param {unknown} v @returns {v is string} */
function isNonEmptyString(v) {
return typeof v === "string" && v.trim().length > 0;
} Try / catch
try {
return new OMLXProvider(config);
} catch (e) {
if (/valid model set/.test(e.message)) {
throw new Error("Please choose an OMLX model before starting the agent.");
}
throw e;
} Prevention
- 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.
When it happens
Trigger: Instantiating OMLXProvider with no config.model while OMLX_LLM_MODEL_PREF is unset in the environment.
Common situations: 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.
Related errors
- LMStudio must have a valid model set.
- OMLX base path must be provided to use agents.
- GenericOpenAI must have a valid base path to use for the api
- No Lemonade API Base Path was set.
- LMStudio base path must be provided to use agents.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/c5656baf6e995de2.
Report an issue: GitHub.