{"record":{"id":"5602cd785cd7bc8d","repo":"Mintplex-Labs/anything-llm","slug":"no-voyage-ai-api-key-was-set","errorCode":null,"errorMessage":"No Voyage AI API key was set.","messagePattern":"No Voyage AI API key was set\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/utils/EmbeddingEngines/voyageAi/index.js","lineNumber":4,"sourceCode":"class VoyageAiEmbedder {\n  constructor() {\n    if (!process.env.VOYAGEAI_API_KEY)\n      throw new Error(\"No Voyage AI API key was set.\");\n\n    const {\n      VoyageEmbeddings,\n    } = require(\"@langchain/community/embeddings/voyage\");\n\n    this.model = process.env.EMBEDDING_MODEL_PREF || \"voyage-3-lite\";\n    this.voyage = new VoyageEmbeddings({\n      apiKey: process.env.VOYAGEAI_API_KEY,\n      modelName: this.model,\n      // Voyage AI's limit per request is 128 https://docs.voyageai.com/docs/rate-limits#use-larger-batches\n      batchSize: 128,\n    });\n    this.embeddingMaxChunkLength = this.#getMaxEmbeddingLength();\n  }\n\n  // https://docs.voyageai.com/docs/embeddings\n  #getMaxEmbeddingLength() {\n    switch (this.model) {","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/EmbeddingEngines/voyageAi/index.js#L1-L22","documentation":"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.","triggerScenarios":"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.","commonSituations":"Users who signed up to Voyage for reranking but never generated an embedding key; multi-node deployments where only some nodes have the env.","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."],"exampleFix":"# .env — before\nEMBEDDING_ENGINE=voyageai\n\n# .env — after\nEMBEDDING_ENGINE=voyageai\nVOYAGEAI_API_KEY=pa-...","handlingStrategy":"validation","validationCode":"if (!process.env.VOYAGEAI_API_KEY) {\n  throw new Error(\n    \"Voyage AI embedder selected but VOYAGEAI_API_KEY is missing — set it before use.\"\n  );\n}\nconst { VoyageAiEmbedder } = require(\"server/utils/EmbeddingEngines/voyageAi\");\nconst embedder = new VoyageAiEmbedder();","typeGuard":"function hasVoyageEmbedderConfig(env = process.env) {\n  return (\n    typeof env.VOYAGEAI_API_KEY === \"string\" && env.VOYAGEAI_API_KEY.length > 0\n  );\n}","tryCatchPattern":"try {\n  new VoyageAiEmbedder();\n} catch (err) {\n  if (err.message === \"No Voyage AI API key was set.\") {\n    // show provider-settings guidance rather than a stack trace\n  }\n}","preventionTips":["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."],"tags":["voyage-ai","embeddings","configuration","environment-variables","api-key"],"backgroundTag":"missing-env-var","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"}