Mintplex-Labs/anything-llm · error · Error

Error downloading model: ${response.statusText}

Error message

Error downloading model: ${response.statusText}

What it means

Thrown by LemonadeUtils.downloadModel when POST /utils/lemonade/download-model returns non-2xx. Structurally identical to DmrUtils.downloadModel (SSE streaming, same outer-Promise catch). Lemonade is the alternative local model server (AMD/NPU-oriented), so failures are typically about the Lemonade server, not the network.

Source

Thrown at frontend/src/models/utils/lemonadeUtils.js:30

  downloadModel: async function (
    modelId,
    basePath = "",
    progressCallback = () => {}
  ) {
    // eslint-disable-next-line no-async-promise-executor
    return new Promise(async (resolve) => {
      try {
        const response = await fetch(
          `${API_BASE}/utils/lemonade/download-model`,
          {
            method: "POST",
            headers: baseHeaders(),
            body: JSON.stringify({ modelId, basePath }),
          }
        );

        if (!response.ok)
          throw new Error("Error downloading model: " + response.statusText);
        const reader = response.body.getReader();
        let done = false;

        while (!done) {
          const { value, done: readerDone } = await reader.read();
          if (readerDone) {
            done = true;
            resolve({ success: true });
          } else {
            const chunk = new TextDecoder("utf-8").decode(value);
            const lines = chunk.split("\n");
            for (const line of lines) {
              if (line.startsWith("data:")) {
                const data = safeJsonParse(line.slice(5));
                switch (data?.type) {
                  case "success":
                    done = true;
                    resolve({ success: true });

View on GitHub (pinned to 526360e320)

Solutions

  1. Confirm the Lemonade server is running and healthy (check its health endpoint).
  2. Verify modelId is in the Lemonade-supported model list before downloading.
  3. Inspect the actual HTTP status and body from the Network tab rather than relying on statusText.
  4. Enhance the error to include response.status and body text.

Example fix

// before
if (!response.ok)
  throw new Error("Error downloading model: " + response.statusText);

// after
if (!response.ok) {
  const body = await response.text().catch(() => "");
  throw new Error(`Lemonade download failed (HTTP ${response.status}): ${body.slice(0, 200)}`);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the Lemonade server is reachable before attempting a download.
async function lemonadeHealthy() {
  try {
    const r = await fetch(`${API_BASE}/utils/lemonade/status`, { headers: baseHeaders() });
    return r.ok;
  } catch { return false; }
}

Type guard

function isDownloadResult(x): x is { success: boolean; error?: string } {
  return x && typeof x.success === 'boolean';
}

Try / catch

const { success, error } = await LemonadeUtils.downloadModel(modelId, basePath, onProgress);
if (!success) {
  showDownloadError(error || 'Lemonade download failed.');
  return;
}

Prevention

When it happens

Trigger: The Lemonade helper server is not running, modelId is not in the Lemonade model index, basePath is invalid, or the Lemonade installation lacks the model's required tokenizer files.

Common situations: User switched to Lemonade provider without starting the Lemonade server; modelId from a HuggingFace repo Lemonade does not whitelist; Lemonade version mismatch where the download API changed; disk full on the Lemonade cache volume.

Related errors


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