{"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/526360e320da9d1b36074be5ed64fe76e5bbfbbd/frontend/src/models/utils/lemonadeUtils.js#L12-L48","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the Lemonade server is running and healthy (check its health endpoint).","Verify modelId is in the Lemonade-supported model list before downloading.","Inspect the actual HTTP status and body from the Network tab rather than relying on statusText.","Enhance the error to include response.status and body text."],"exampleFix":"// before\nif (!response.ok)\n  throw new Error(\"Error downloading model: \" + response.statusText);\n\n// after\nif (!response.ok) {\n  const body = await response.text().catch(() => \"\");\n  throw new Error(`Lemonade download failed (HTTP ${response.status}): ${body.slice(0, 200)}`);\n}","handlingStrategy":"try-catch","validationCode":"// Verify the Lemonade server is reachable before attempting a download.\nasync function lemonadeHealthy() {\n  try {\n    const r = await fetch(`${API_BASE}/utils/lemonade/status`, { headers: baseHeaders() });\n    return r.ok;\n  } catch { return false; }\n}","typeGuard":"function isDownloadResult(x): x is { success: boolean; error?: string } {\n  return x && typeof x.success === 'boolean';\n}","tryCatchPattern":"const { success, error } = await LemonadeUtils.downloadModel(modelId, basePath, onProgress);\nif (!success) {\n  showDownloadError(error || 'Lemonade download failed.');\n  return;\n}","preventionTips":["Confirm the Lemonade server is running before offering the download button.","Verify modelId is in the Lemonade-supported list.","Surface the real HTTP body, not just statusText, in error UI."],"tags":["frontend","api-client","model-download","lemonade","streaming","network"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}