Mintplex-Labs/anything-llm · error · Error

Error downloading model

Error message

Error downloading model: ${response.statusText}

What it means

Thrown by the Lemonade download helper in the AnythingLLM frontend when POST /api/utils/lemonade/download-model responds non-2xx before the NDJSON progress stream starts; the message is the fixed prefix plus response.statusText. The backend delegates to a Lemonade inference server, so failures here usually mean that server was unreachable or rejected the model request.

Solutions

  1. Start the Lemonade server and confirm the backend points at the right host/port.
  2. Retry — this helper resolves on completion or failure, and a fresh attempt after the server is up usually proceeds.
  3. Verify the modelId exists in the Lemonade catalog.
  4. Check free disk space on basePath and server logs for the underlying error.
Defensive patterns

Strategy: retry

Validate before calling

// run before lemonade downloadModel
if (!modelId || typeof modelId !== 'string') throw new Error('modelId is required');
if (!basePath) throw new Error('basePath is required');

Try / catch

let result = await downloadModel(modelId, basePath, onProgress);
if (!result?.success && attempt < 2) {
  await ensureLemonadeServerUp(); // start/reach the Lemonade server, then retry once
  result = await downloadModel(modelId, basePath, onProgress);
}
if (!result?.success) showModelError('Lemonade model download failed to start');

Prevention

When it happens

Trigger: The Lemonade server is not running or listening on the expected port when the backend issues the download; an invalid/unknown modelId; basePath not writable or out of disk; server-side exception before streaming begins.

Common situations: Lemonade not started before pulling models; port or host changed since configuration; model id not present in Lemonade's registry; storage volume full.

Related errors


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

Appendix: 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 3aec848f28)