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/lemonade/download-model when the Lemonade inference server's POST /api/v1/pull returns a non-OK HTTP status. The Error prefers lemonadeResponse.statusText and falls back to this string when statusText is empty. This is the HTTP-level failure counterpart to the streaming error in 132.
Source
Thrown at server/endpoints/utils/lemonadeUtilsEndpoints.js:48
"Cache-Control": "no-cache",
Connection: "keep-alive",
});
const lemonadeResponse = await fetch(lemonadeUrl.toString(), {
method: "POST",
headers: {
...(!!process.env.LEMONADE_LLM_API_KEY
? { Authorization: `Bearer ${process.env.LEMONADE_LLM_API_KEY}` }
: {}),
"Content-Type": "application/json",
},
body: JSON.stringify({
model_name: String(modelId),
stream: true,
}),
});
if (!lemonadeResponse.ok)
throw new Error(
lemonadeResponse.statusText ||
"An error occurred while downloading the model"
);
const reader = lemonadeResponse.body.getReader();
let done = false;
let currentEvent = null;
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;
if (line.startsWith("event:")) {
currentEvent = line.replace("event:", "").trim();View on GitHub (pinned to 526360e320)
Solutions
- Confirm the Lemonade server is running and reachable at LEMONADE_LLM_BASE_PATH.
- If the server requires auth, set LEMONADE_LLM_API_KEY to a valid key.
- Validate the modelId is supported by the Lemonade instance.
- curl the /api/v1/pull endpoint directly to read the real status and body.
Defensive patterns
Strategy: try-catch
Try / catch
try {
await downloadFromLemonade(modelId, basePath);
} catch (e) {
logger.error('Lemonade pull HTTP error', { modelId, message: e.message });
res.write(`data: ${JSON.stringify({ type: 'error', message: 'Lemonade server rejected the pull request.' })}\n\n`);
} Prevention
- Confirm LEMONADE_LLM_BASE_PATH and the server is up before pulling.
- Set LEMONADE_LLM_API_KEY when the server enforces auth.
- curl /api/v1/pull manually to read the real status/body.
When it happens
Trigger: LEMONADE_LLM_BASE_PATH is wrong or the Lemonade server is down; LEMONADE_LLM_API_KEY is missing/invalid and the server rejects with 401/403; the modelId is not pullable; the server returned an error status with an empty reason phrase.
Common situations: Lemonade server not started; API key env var unset on the AnythingLLM side while the server requires auth; base path typo; Lemonade version that returns bare status codes.
Related errors
- Error downloading model: ${response.statusText}
- The native whisper model failed to download from the hugging
- res.statusText || "Error generating api key."
- Error downloading model: ${response.statusText}
- An error occurred while downloading the model
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/bce4c2ec3f9221d7.
Report an issue: GitHub.