Mintplex-Labs/anything-llm · critical · Error

No Docker Model Runner Model Pref was set.

Error message

No Docker Model Runner Model Pref was set.

What it means

Constructor guard that prevents DockerModelRunnerLLM instantiation when neither the modelPreference constructor argument nor the DOCKER_MODEL_RUNNER_LLM_MODEL_PREF env var is set. Docker Model Runner requires an explicit model id (e.g. 'ai/qwen2.5:7B-Q6_K') because it does not expose a model listing endpoint for defaults. Without a model the client cannot target a completion.

Source

Thrown at server/utils/AiProviders/dockerModelRunner/index.js:27

  LLMPerformanceMonitor,
} = require("../../helpers/chat/LLMPerformanceMonitor");
const { OpenAI: OpenAIApi } = require("openai");
const { humanFileSize } = require("../../helpers");
const { safeJsonParse } = require("../../http");

class DockerModelRunnerLLM {
  static cacheTime = 1000 * 60 * 60 * 24; // 24 hours
  static cacheFolder = path.resolve(
    process.env.STORAGE_DIR
      ? path.resolve(process.env.STORAGE_DIR, "models", "docker-model-runner")
      : path.resolve(__dirname, `../../../storage/models/docker-model-runner`)
  );

  constructor(embedder = null, modelPreference = null) {
    if (!process.env.DOCKER_MODEL_RUNNER_BASE_PATH)
      throw new Error("No Docker Model Runner API Base Path was set.");
    if (!process.env.DOCKER_MODEL_RUNNER_LLM_MODEL_PREF && !modelPreference)
      throw new Error("No Docker Model Runner Model Pref was set.");

    this.className = "DockerModelRunnerLLM";
    this.dmr = new OpenAIApi({
      baseURL: parseDockerModelRunnerEndpoint(
        process.env.DOCKER_MODEL_RUNNER_BASE_PATH
      ),
      apiKey: null,
    });

    this.model =
      modelPreference || process.env.DOCKER_MODEL_RUNNER_LLM_MODEL_PREF;
    this.embedder = embedder ?? new NativeEmbedder();
    this.defaultTemp = 0.7;

    this.limits = {
      history: this.promptWindowLimit() * 0.15,
      system: this.promptWindowLimit() * 0.15,
      user: this.promptWindowLimit() * 0.7,

View on GitHub (pinned to 526360e320)

Solutions

  1. Pull a model with `docker model pull ai/<model>` and set DOCKER_MODEL_RUNNER_LLM_MODEL_PREF to the exact model id.
  2. Pass the model id as the modelPreference argument when constructing programmatically.
  3. List available models with `docker model list` to get the exact id string.
  4. Set the model in the AnythingLLM Docker Model Runner provider settings and save.

Example fix

# .env
DOCKER_MODEL_RUNNER_LLM_MODEL_PREF=ai/qwen2.5:7B-Q6_K
Defensive patterns

Strategy: validation

Validate before calling

const modelPref = process.env.DOCKER_MODEL_RUNNER_LLM_MODEL_PREF || passedModelPreference;
if (!modelPref) throw new Error('A model id (e.g. ai/qwen2.5:7B-Q6_K) must be set via DOCKER_MODEL_RUNNER_LLM_MODEL_PREF');

Try / catch

try {
  provider = new DockerModelRunnerLLM(embedder, modelPref);
} catch (e) {
  if (/No Docker Model Runner Model Pref/i.test(e.message))
    return respondConfigError('Set DOCKER_MODEL_RUNNER_LLM_MODEL_PREF to a pulled model id (run `docker model list`).');
  throw e;
}

Prevention

When it happens

Trigger: Constructing DockerModelRunnerLLM with both the modelPreference argument null/undefined and DOCKER_MODEL_RUNNER_LLM_MODEL_PREF unset or empty; selecting the provider without choosing a model.

Common situations: Fresh setup where the base path was configured but no model was selected; the model was pulled via `docker model pull` but its exact id was not set as the preference; env var typo.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/8ad96808290be61f. Report an issue: GitHub.