{"record":{"id":"cee762571d7533e3","repo":"Mintplex-Labs/anything-llm","slug":"an-error-occurred-while-downloading-the-model","errorCode":null,"errorMessage":"An error occurred while downloading the model","messagePattern":"An error occurred while downloading the model","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/endpoints/utils/dockerModelRunnerUtils.js","lineNumber":42,"sourceCode":"            \"dmr\"\n          )\n        );\n        dmrUrl.pathname = \"/models/create\";\n        response.writeHead(200, {\n          \"Content-Type\": \"text/event-stream\",\n          \"Cache-Control\": \"no-cache\",\n          Connection: \"keep-alive\",\n        });\n\n        const dmrResponse = await fetch(dmrUrl.toString(), {\n          method: \"POST\",\n          headers: {\n            \"Content-Type\": \"application/json\",\n          },\n          body: JSON.stringify({ from: String(modelId) }),\n        });\n        if (!dmrResponse.ok)\n          throw new Error(\n            dmrResponse.statusText ||\n              \"An error occurred while downloading the model\"\n          );\n        const reader = dmrResponse.body.getReader();\n        let done = false;\n        while (!done) {\n          const { value, done: readerDone } = await reader.read();\n          if (readerDone) done = true;\n\n          const chunk = new TextDecoder(\"utf-8\").decode(value);\n          const lines = chunk.split(\"\\n\");\n          for (const line of lines) {\n            if (!line.trim()) continue;\n            const decodedLine = decodeHtmlEntities(line);\n            const data = safeJsonParse(decodedLine);\n            if (!data) continue;\n\n            if (data.type === \"error\") {","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/endpoints/utils/dockerModelRunnerUtils.js#L24-L60","documentation":"Thrown by POST /utils/dmr/download-model when the Docker Model Runner endpoint POST /models/create returns a non-OK HTTP status. The Error prefers dmrResponse.statusText and only uses this fallback string when statusText is empty. The endpoint streams SSE progress to the client, so this error short-circuits before any streaming begins.","triggerScenarios":"DMR base path is wrong or unreachable; Docker Desktop / Docker Model Runner is not running; the modelId is unknown to the registry; an auth/network layer returned an error status with an empty reason phrase.","commonSituations":"DOCKER_MODEL_RUNNER_BASE_PATH env var unset or misconfigured; Docker not started; the model tag was misspelled; a corporate proxy returned a 4xx with no status text.","solutions":["Verify Docker Desktop with Model Runner is running: `docker info` and check the DMR endpoint.","Confirm DOCKER_MODEL_RUNNER_BASE_PATH (or the request basePath) resolves to the correct DMR URL.","Validate the modelId is a tag DMR can pull.","Reproduce the POST manually with curl to read the real status line/body."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await downloadFromDmr(modelId, basePath);\n} catch (e) {\n  if (e.message.includes('downloading the model')) {\n    logger.error('DMR pull failed', { modelId, statusText: e.message });\n    res.write(`data: ${JSON.stringify({ type: 'error', message: 'Docker Model Runner is unavailable or rejected the model.' })}\\n\\n`);\n  }\n  throw e;\n}","preventionTips":["Preflight: ping the DMR endpoint before starting the pull stream.","Verify DOCKER_MODEL_RUNNER_BASE_PATH in config.","Surface statusText to the client when present so the fallback is rarely seen."],"tags":["docker-model-runner","model-download","network","sse"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}