{"record":{"id":"bb0d39a2907f6cd5","repo":"Mintplex-Labs/anything-llm","slug":"no-cohere-api-key-was-set-bb0d39","errorCode":null,"errorMessage":"No Cohere API key was set.","messagePattern":"No Cohere API key was set\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/EmbeddingEngines/cohere/index.js","lineNumber":6,"sourceCode":"const { toChunks, reportEmbeddingProgress } = require(\"../../helpers\");\n\nclass CohereEmbedder {\n  constructor() {\n    if (!process.env.COHERE_API_KEY)\n      throw new Error(\"No Cohere API key was set.\");\n    this.className = \"CohereEmbedder\";\n\n    // Cohere exposes an OpenAI-compatible API which lets us reuse the OpenAI SDK\n    // across the app instead of the cohere-ai package. The compatibility endpoint\n    // manages the embedding `input_type` internally so we do not set it ourselves.\n    // https://docs.cohere.com/docs/compatibility-api\n    const { OpenAI: OpenAIApi } = require(\"openai\");\n    this.openai = new OpenAIApi({\n      baseURL: \"https://api.cohere.ai/compatibility/v1\",\n      apiKey: process.env.COHERE_API_KEY,\n    });\n\n    this.model = process.env.EMBEDDING_MODEL_PREF || \"embed-english-v3.0\";\n\n    // Limit of how many strings we can process in a single pass to stay with resource or network limits\n    this.maxConcurrentChunks = 96; // Cohere's limit per request is 96\n    this.embeddingMaxChunkLength = 1945; // https://docs.cohere.com/docs/embed-2 - assume a token is roughly 4 letters with some padding\n  }","sourceCodeStart":1,"sourceCodeEnd":24,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/EmbeddingEngines/cohere/index.js#L1-L24","documentation":"Configuration guard thrown by the CohereEmbedder constructor: the Cohere embedding engine was selected but the COHERE_API_KEY environment variable is empty/unset, so the OpenAI-compatible Cohere endpoint cannot be authenticated.","triggerScenarios":"Thrown at embedder construction when no Cohere API key is configured.","commonSituations":"Cohere embedder selected without an API key.","solutions":["Set the Cohere API key in embedder settings."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}