{"record":{"id":"91f1be280e0c5667","repo":"Mintplex-Labs/anything-llm","slug":"error-downloading-model-response-statustext","errorCode":null,"errorMessage":"Error downloading model: ${response.statusText}","messagePattern":"Error downloading model: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/models/utils/dmrUtils.js","lineNumber":27,"sourceCode":"   * @param {(percentage: number) => void} progressCallback - The callback to receive the progress percentage. If the model is already downloaded, it will be called once with 100.\n   * @returns {Promise<{success: boolean, error: string|null}>}\n   */\n  downloadModel: async function (\n    modelId,\n    basePath = \"\",\n    progressCallback = () => {}\n  ) {\n    // eslint-disable-next-line no-async-promise-executor\n    return new Promise(async (resolve) => {\n      try {\n        const response = await fetch(`${API_BASE}/utils/dmr/download-model`, {\n          method: \"POST\",\n          headers: baseHeaders(),\n          body: JSON.stringify({ modelId, basePath }),\n        });\n\n        if (!response.ok)\n          throw new Error(\"Error downloading model: \" + response.statusText);\n        const reader = response.body.getReader();\n        let done = false;\n\n        while (!done) {\n          const { value, done: readerDone } = await reader.read();\n          if (readerDone) {\n            done = true;\n            resolve({ success: true });\n          } else {\n            const chunk = new TextDecoder(\"utf-8\").decode(value);\n            const lines = chunk.split(\"\\n\");\n            for (const line of lines) {\n              if (line.startsWith(\"data:\")) {\n                const data = safeJsonParse(line.slice(5));\n                switch (data?.type) {\n                  case \"success\":\n                    done = true;\n                    resolve({ success: true });","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/frontend/src/models/utils/dmrUtils.js#L9-L45","documentation":"Thrown by the DMR (model router) download helper in the AnythingLLM frontend before any progress is read: POST /api/utils/dmr/download-model responded non-2xx. The message concatenates the fixed prefix with response.statusText. The endpoint normally streams NDJSON progress while the server-side DMR CLI pulls the model, so this throw means the download never started.","triggerScenarios":"The DMR tool/CLI is not installed on the server so it cannot be spawned; an invalid modelId; basePath not writable or out of disk space; any server-side exception raised before the stream begins (all surface as a non-2xx status here).","commonSituations":"Attempting a model pull before installing the DMR runtime; typo'd model id; storage volume full or read-only; server updated and the DMR invocation contract changed.","solutions":["Confirm the DMR tool is installed and invocable server-side; test the same download from its CLI.","Double-check the modelId against the DMR model registry.","Check free disk space and write permissions on basePath.","Inspect server logs and the Network status code (4xx vs 5xx) for the underlying spawn error."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// run before dmr downloadModel\nif (!modelId || typeof modelId !== 'string') throw new Error('modelId is required');\nif (!basePath) throw new Error('basePath is required');\nif (navigator.storage?.estimate) {\n  const { usage, quota } = await navigator.storage.estimate();\n  if (quota - usage < MIN_FREE_BYTES) throw new Error('Not enough space for the model');\n}","typeGuard":null,"tryCatchPattern":"const result = await downloadModel(modelId, basePath, onProgress);\nif (!result?.success) {\n  // thrown before streaming: DMR not installed, bad modelId, or no space\n  showModelError('Model download did not start — verify the DMR tool is installed');\n}","preventionTips":["Install and smoke-test the DMR CLI server-side before exposing model downloads in the UI.","Validate modelId against the registry before starting a download.","Check free disk space on basePath; a non-2xx before the stream starts is usually environmental."],"tags":["anythingllm","dmr","model-download","streaming","http"],"backgroundTag":"model-download-failed","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}