Mintplex-Labs/anything-llm · error
No Voyage AI API key was set.
Error message
No Voyage AI API key was set.
What it means
The VoyageAiEmbedder constructor throws immediately when VOYAGEAI_API_KEY is unset or empty. The key is required to instantiate the @langchain/community VoyageEmbeddings client (default model voyage-3-lite, batchSize 128), so provider selection fails fast at construction time.
Solutions
- Create an API key at dashboard.voyageai.com and set VOYAGEAI_API_KEY in .env.
- Restart the server / recreate the container after saving.
- Confirm the key is active and has quota for the chosen model (default voyage-3-lite).
- Double-check the variable spelling and absence of surrounding whitespace.
Example fix
# .env — before EMBEDDING_ENGINE=voyageai # .env — after EMBEDDING_ENGINE=voyageai VOYAGEAI_API_KEY=pa-...
Defensive patterns
Strategy: validation
Validate before calling
if (!process.env.VOYAGEAI_API_KEY) {
throw new Error(
"Voyage AI embedder selected but VOYAGEAI_API_KEY is missing — set it before use."
);
}
const { VoyageAiEmbedder } = require("server/utils/EmbeddingEngines/voyageAi");
const embedder = new VoyageAiEmbedder(); Type guard
function hasVoyageEmbedderConfig(env = process.env) {
return (
typeof env.VOYAGEAI_API_KEY === "string" && env.VOYAGEAI_API_KEY.length > 0
);
} Try / catch
try {
new VoyageAiEmbedder();
} catch (err) {
if (err.message === "No Voyage AI API key was set.") {
// show provider-settings guidance rather than a stack trace
}
} Prevention
- Store the Voyage key in .env at setup time, alongside the engine selection.
- Verify the key on the Voyage dashboard before large ingestions.
- Env-check at boot for the active engine.
When it happens
Trigger: Selecting Voyage AI as the embedding engine without an API key from dashboard.voyageai.com; setting the key after the process started without restart; a typo in the variable name; docker env not propagated.
Common situations: Users who signed up to Voyage for reranking but never generated an embedding key; multi-node deployments where only some nodes have the env.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- No OpenAI API key was set.
- No OpenRouter API key was set.
- No embedding model was set.
- No Minimax API key was set.
- No Mistral API key was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/5602cd785cd7bc8d.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/EmbeddingEngines/voyageAi/index.js:4
class VoyageAiEmbedder {
constructor() {
if (!process.env.VOYAGEAI_API_KEY)
throw new Error("No Voyage AI API key was set.");
const {
VoyageEmbeddings,
} = require("@langchain/community/embeddings/voyage");
this.model = process.env.EMBEDDING_MODEL_PREF || "voyage-3-lite";
this.voyage = new VoyageEmbeddings({
apiKey: process.env.VOYAGEAI_API_KEY,
modelName: this.model,
// Voyage AI's limit per request is 128 https://docs.voyageai.com/docs/rate-limits#use-larger-batches
batchSize: 128,
});
this.embeddingMaxChunkLength = this.#getMaxEmbeddingLength();
}
// https://docs.voyageai.com/docs/embeddings
#getMaxEmbeddingLength() {
switch (this.model) {View on GitHub (pinned to 3aec848f28)