{"record":{"id":"ecd096738f52b722","repo":"rohitg00/agentmemory","slug":"voyage-api-key-is-required","errorCode":null,"errorMessage":"VOYAGE_API_KEY is required","messagePattern":"VOYAGE_API_KEY is required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/providers/embedding/voyage.ts","lineNumber":14,"sourceCode":"import type { EmbeddingProvider } from \"../../types.js\";\nimport { getEnvVar } from \"../../config.js\";\nimport { fetchWithTimeout } from \"../_fetch.js\";\n\nconst API_URL = \"https://api.voyageai.com/v1/embeddings\";\n\nexport class VoyageEmbeddingProvider implements EmbeddingProvider {\n  readonly name = \"voyage\";\n  readonly dimensions = 1024;\n  private apiKey: string;\n\n  constructor(apiKey?: string) {\n    this.apiKey = apiKey || getEnvVar(\"VOYAGE_API_KEY\") || \"\";\n    if (!this.apiKey) throw new Error(\"VOYAGE_API_KEY is required\");\n  }\n\n  async embed(text: string): Promise<Float32Array> {\n    const [result] = await this.embedBatch([text]);\n    return result;\n  }\n\n  async embedBatch(texts: string[]): Promise<Float32Array[]> {\n    const response = await fetchWithTimeout(API_URL, {\n      method: \"POST\",\n      headers: {\n        Authorization: `Bearer ${this.apiKey}`,\n        \"Content-Type\": \"application/json\",\n      },\n      body: JSON.stringify({\n        model: \"voyage-code-3\",\n        input: texts,\n        input_type: \"document\",","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/rohitg00/agentmemory/blob/e04ba88819c365c9acf9d6661ea802143e728bd6/src/providers/embedding/voyage.ts#L1-L32","documentation":"VoyageEmbeddingProvider requires a Voyage AI API key from the constructor argument or the VOYAGE_API_KEY environment variable. If both are empty the constructor throws immediately.","triggerScenarios":"Constructing `new VoyageEmbeddingProvider()` (or selecting type 'voyage' through createEmbeddingProvider) with no apiKey argument and VOYAGE_API_KEY unset in env or ~/.agentmemory/.env.","commonSituations":"Trying the voyage provider for its 1024-dim vectors without having a Voyage account/key; secrets provisioned for OpenAI but not Voyage; env var exported in one shell but not the service's environment; .env file path mismatch.","solutions":["Get a key at dashboard.voyageai.com and set VOYAGE_API_KEY in ~/.agentmemory/.env or the environment","Pass it explicitly: new VoyageEmbeddingProvider(key)","Verify the env var name is exactly VOYAGE_API_KEY and that dotenv loading happens before provider creation","Choose a different provider type (openai/openrouter/local) if Voyage is not intended"],"exampleFix":"// before\nconst provider = new VoyageEmbeddingProvider(); // VOYAGE_API_KEY missing\n// after\n// ~/.agentmemory/.env: VOYAGE_API_KEY=pa-...\nconst provider = new VoyageEmbeddingProvider();","handlingStrategy":"validation","validationCode":"const key = process.env.VOYAGE_API_KEY;\nif (!key) throw new Error('Set VOYAGE_API_KEY before using the voyage embedding provider');\nconst provider = new VoyageEmbeddingProvider(key);","typeGuard":"const hasVoyageKey = (k: string | undefined): k is string => typeof k === 'string' && k.startsWith('pa-');","tryCatchPattern":"try {\n  provider = new VoyageEmbeddingProvider();\n} catch (err) {\n  if (err instanceof Error && err.message === 'VOYAGE_API_KEY is required') {\n    console.error('Get a key at dashboard.voyageai.com and set VOYAGE_API_KEY');\n    process.exit(1);\n  }\n  throw err;\n}","preventionTips":["Provision VOYAGE_API_KEY alongside other provider keys in ~/.agentmemory/.env","Run a startup capability check per enabled provider type","Don't enable the voyage provider type unless you hold a valid key","Document which provider types need which env vars in your deployment guide"],"tags":["api-key","missing-env-var","voyage","configuration"],"backgroundTag":"missing-api-key","analyzedSha":"e04ba88819c365c9acf9d6661ea802143e728bd6","analyzedAt":"2026-08-30T01:07:40.754Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}