Mintplex-Labs/anything-llm · error · Error

An error occurred while downloading the model

Error message

An error occurred while downloading the model

What it means

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.

Source

Thrown at server/endpoints/utils/dockerModelRunnerUtils.js:42

            "dmr"
          )
        );
        dmrUrl.pathname = "/models/create";
        response.writeHead(200, {
          "Content-Type": "text/event-stream",
          "Cache-Control": "no-cache",
          Connection: "keep-alive",
        });

        const dmrResponse = await fetch(dmrUrl.toString(), {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
          },
          body: JSON.stringify({ from: String(modelId) }),
        });
        if (!dmrResponse.ok)
          throw new Error(
            dmrResponse.statusText ||
              "An error occurred while downloading the model"
          );
        const reader = dmrResponse.body.getReader();
        let done = false;
        while (!done) {
          const { value, done: readerDone } = await reader.read();
          if (readerDone) done = true;

          const chunk = new TextDecoder("utf-8").decode(value);
          const lines = chunk.split("\n");
          for (const line of lines) {
            if (!line.trim()) continue;
            const decodedLine = decodeHtmlEntities(line);
            const data = safeJsonParse(decodedLine);
            if (!data) continue;

            if (data.type === "error") {

View on GitHub (pinned to 526360e320)

Solutions

  1. Verify Docker Desktop with Model Runner is running: `docker info` and check the DMR endpoint.
  2. Confirm DOCKER_MODEL_RUNNER_BASE_PATH (or the request basePath) resolves to the correct DMR URL.
  3. Validate the modelId is a tag DMR can pull.
  4. Reproduce the POST manually with curl to read the real status line/body.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await downloadFromDmr(modelId, basePath);
} catch (e) {
  if (e.message.includes('downloading the model')) {
    logger.error('DMR pull failed', { modelId, statusText: e.message });
    res.write(`data: ${JSON.stringify({ type: 'error', message: 'Docker Model Runner is unavailable or rejected the model.' })}\n\n`);
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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