{"record":{"id":"bd6b66f082d54524","repo":"Mintplex-Labs/anything-llm","slug":"error-downloading-model-response-statustext-bd6b66","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/lemonadeUtils.js","lineNumber":30,"sourceCode":"  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(\n          `${API_BASE}/utils/lemonade/download-model`,\n          {\n            method: \"POST\",\n            headers: baseHeaders(),\n            body: JSON.stringify({ modelId, basePath }),\n          }\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":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/frontend/src/models/utils/lemonadeUtils.js#L12-L48","documentation":"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.","triggerScenarios":"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.","commonSituations":"Lemonade not started before pulling models; port or host changed since configuration; model id not present in Lemonade's registry; storage volume full.","solutions":["Start the Lemonade server and confirm the backend points at the right host/port.","Retry — this helper resolves on completion or failure, and a fresh attempt after the server is up usually proceeds.","Verify the modelId exists in the Lemonade catalog.","Check free disk space on basePath and server logs for the underlying error."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// run before lemonade downloadModel\nif (!modelId || typeof modelId !== 'string') throw new Error('modelId is required');\nif (!basePath) throw new Error('basePath is required');","typeGuard":null,"tryCatchPattern":"let result = await downloadModel(modelId, basePath, onProgress);\nif (!result?.success && attempt < 2) {\n  await ensureLemonadeServerUp(); // start/reach the Lemonade server, then retry once\n  result = await downloadModel(modelId, basePath, onProgress);\n}\nif (!result?.success) showModelError('Lemonade model download failed to start');","preventionTips":["Start the Lemonade server before offering model downloads in the UI.","Verify the backend's Lemonade host/port configuration matches the running server.","Retry once after bringing the server up — the failure is often just ordering, not state."],"tags":["anythingllm","lemonade","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"}