Mintplex-Labs/anything-llm · error · Error
Lemonade Failed to embed
Error message
Lemonade Failed to embed: [${error.type}]: ${error.message} What it means
Thrown from LemonadeEmbedder.embedChunks when a chunk request to the Lemonade server fails. Before throwing, each failure is normalized into type (HTTP error code or status, default 'failed_to_embed') and message (response body message), and the final text is formatted '[type]: message'. It is also written to the log, so the console shows the same string.
Solutions
- Check the [type] segment — an HTTP code points at the server's response, 'failed_to_embed' usually means a transport-level failure
- Confirm the model id in EMBEDDING_MODEL_PREF is downloaded and loaded in Lemonade (model must be running, not just listed)
- Verify the Lemonade server is up at EMBEDDING_BASE_PATH (open its UI or hit its /models endpoint)
- Retry the embedding — if it fails mid-run, restart the Lemonade server first
- Update Lemonade to a build that supports the OpenAI embeddings route
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-flight: model must be listed as loaded on the Lemonade server
async function lemonadeModelReady(openai, model) {
try {
const res = await openai.models.list();
return res.data.some((m) => m.id === model);
} catch {
return false;
}
} Try / catch
try {
const vectors = await embedder.embedTextInput(text);
} catch (e) {
if (e.message.startsWith("Lemonade Failed to embed:")) {
const m = e.message; // format: [type]: message
if (/\[(404|400)\]/.test(m)) { /* model not loaded — load it, then retry this document */ }
else if (/\[failed_to_embed\]/.test(m)) { /* transport/server down — restart Lemonade, retry once */ }
else throw e;
} else throw e;
} Prevention
- Confirm the model is downloaded AND loaded (not merely listed) before starting a bulk embed
- Keep the Lemonade server awake during long jobs — sleep/crash mid-run produces failed_to_embed types
- Re-embed failed documents from scratch after fixing; the loop stops at the first failing chunk
When it happens
Trigger: EMBEDDING_MODEL_PREF names a model that is not downloaded/loaded in Lemonade (typically 404/400 from the server); the Lemonade server is stopped or restarted mid-embedding (fetch/ECONNREFUSED normalized to failed_to_embed); NPU/RAM pressure causing the server to error on a chunk; unsupported encoding_format or request shape on older Lemonade builds.
Common situations: Embedding documents right after picking a model id that was never pulled; laptop sleeping or Lemonade crashing during a large workspace embed; version mismatch between the Lemonade server and this OpenAI-compatible client.
Related errors
- Gemini Failed to embed
- GenericOpenAI Failed to embed
- LiteLLM Failed to embed
- LMStudio Failed to embed
- LMStudio service could not be reached. Is LMStudio running?
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/641f4b1f225e646d.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/EmbeddingEngines/lemonade/index.js:81
});
return;
}
resolve({ data: result?.data, error: null });
})
.catch((e) => {
e.type =
e?.response?.data?.error?.code ||
e?.response?.status ||
"failed_to_embed";
e.message = e?.response?.data?.error?.message || e.message;
resolve({ data: [], error: e });
});
});
if (error) {
const errorMsg = `Lemonade Failed to embed: [${error.type}]: ${error.message}`;
this.log(errorMsg);
throw new Error(errorMsg);
}
allResults.push(...(data || []));
reportEmbeddingProgress(
Math.min(allResults.length, textChunks.length),
textChunks.length
);
}
return allResults.length > 0 &&
allResults.every((embd) => embd.hasOwnProperty("embedding"))
? allResults.map((embd) => embd.embedding)
: null;
}
}
module.exports = {
LemonadeEmbedder,
};View on GitHub (pinned to 3aec848f28)