{"record":{"id":"8ad96808290be61f","repo":"Mintplex-Labs/anything-llm","slug":"no-docker-model-runner-model-pref-was-set","errorCode":null,"errorMessage":"No Docker Model Runner Model Pref was set.","messagePattern":"No Docker Model Runner Model Pref was set\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"server/utils/AiProviders/dockerModelRunner/index.js","lineNumber":27,"sourceCode":"  LLMPerformanceMonitor,\n} = require(\"../../helpers/chat/LLMPerformanceMonitor\");\nconst { OpenAI: OpenAIApi } = require(\"openai\");\nconst { humanFileSize } = require(\"../../helpers\");\nconst { safeJsonParse } = require(\"../../http\");\n\nclass DockerModelRunnerLLM {\n  static cacheTime = 1000 * 60 * 60 * 24; // 24 hours\n  static cacheFolder = path.resolve(\n    process.env.STORAGE_DIR\n      ? path.resolve(process.env.STORAGE_DIR, \"models\", \"docker-model-runner\")\n      : path.resolve(__dirname, `../../../storage/models/docker-model-runner`)\n  );\n\n  constructor(embedder = null, modelPreference = null) {\n    if (!process.env.DOCKER_MODEL_RUNNER_BASE_PATH)\n      throw new Error(\"No Docker Model Runner API Base Path was set.\");\n    if (!process.env.DOCKER_MODEL_RUNNER_LLM_MODEL_PREF && !modelPreference)\n      throw new Error(\"No Docker Model Runner Model Pref was set.\");\n\n    this.className = \"DockerModelRunnerLLM\";\n    this.dmr = new OpenAIApi({\n      baseURL: parseDockerModelRunnerEndpoint(\n        process.env.DOCKER_MODEL_RUNNER_BASE_PATH\n      ),\n      apiKey: null,\n    });\n\n    this.model =\n      modelPreference || process.env.DOCKER_MODEL_RUNNER_LLM_MODEL_PREF;\n    this.embedder = embedder ?? new NativeEmbedder();\n    this.defaultTemp = 0.7;\n\n    this.limits = {\n      history: this.promptWindowLimit() * 0.15,\n      system: this.promptWindowLimit() * 0.15,\n      user: this.promptWindowLimit() * 0.7,","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/AiProviders/dockerModelRunner/index.js#L9-L45","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pull a model with `docker model pull ai/<model>` and set DOCKER_MODEL_RUNNER_LLM_MODEL_PREF to the exact model id.","Pass the model id as the modelPreference argument when constructing programmatically.","List available models with `docker model list` to get the exact id string.","Set the model in the AnythingLLM Docker Model Runner provider settings and save."],"exampleFix":"# .env\nDOCKER_MODEL_RUNNER_LLM_MODEL_PREF=ai/qwen2.5:7B-Q6_K","handlingStrategy":"validation","validationCode":"const modelPref = process.env.DOCKER_MODEL_RUNNER_LLM_MODEL_PREF || passedModelPreference;\nif (!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');","typeGuard":null,"tryCatchPattern":"try {\n  provider = new DockerModelRunnerLLM(embedder, modelPref);\n} catch (e) {\n  if (/No Docker Model Runner Model Pref/i.test(e.message))\n    return respondConfigError('Set DOCKER_MODEL_RUNNER_LLM_MODEL_PREF to a pulled model id (run `docker model list`).');\n  throw e;\n}","preventionTips":["Pull a model with `docker model pull` and copy the exact id from `docker model list`.","Set the model id in .env or pass it as the modelPreference constructor argument.","Verify the model is loaded before configuring it as the preference."],"tags":["docker-model-runner","missing-model","constructor-guard","env-var","local-llm"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}