{"record":{"id":"bec2b7ab12fca6a6","repo":"Mintplex-Labs/anything-llm","slug":"no-groq-api-key-was-set-bec2b7","errorCode":null,"errorMessage":"No Groq API key was set.","messagePattern":"No Groq API key was set\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/SpeechToText/groq/index.js","lineNumber":4,"sourceCode":"class GroqSTT {\n  constructor() {\n    if (!process.env.STT_GROQ_API_KEY)\n      throw new Error(\"No Groq API key was set.\");\n    const { OpenAI: OpenAIApi } = require(\"openai\");\n    this.openai = new OpenAIApi({\n      baseURL: \"https://api.groq.com/openai/v1\",\n      apiKey: process.env.STT_GROQ_API_KEY,\n    });\n    this.model = process.env.STT_GROQ_MODEL ?? \"whisper-large-v3-turbo\";\n  }\n\n  #log(text, ...args) {\n    console.log(`\\x1b[32m[GroqSTT]\\x1b[0m ${text}`, ...args);\n  }\n\n  /**\n   * Transcribes an audio buffer to text using the Groq STT service.\n   * @param {Buffer} audioBuffer - The audio buffer to be transcribed.\n   * @param {string} filename - Original filename, used to hint the audio container/codec to Groq.\n   * @returns {Promise<string>} The transcribed text.\n   */","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/SpeechToText/groq/index.js#L1-L22","documentation":"Thrown by the GroqSTT constructor when process.env.STT_GROQ_API_KEY is falsy. The class builds an OpenAI-compatible client pointed at https://api.groq.com/openai/v1 and needs the key for the Authorization header. It hard-fails at instantiation, so selecting STT_PROVIDER=groq without the key prevents service creation.","triggerScenarios":"STT_PROVIDER=groq is set but STT_GROQ_API_KEY is missing/empty; env var added but process not restarted; key set under a different name.","commonSituations":"New deployment forgetting the Groq key; Docker env not propagated; .env not loaded; switching providers without updating keys.","solutions":["Add STT_GROQ_API_KEY=<your-key> to .env and restart.","In Docker, ensure the variable is passed to the container.","Confirm the exact name STT_GROQ_API_KEY.","Optionally set STT_GROQ_MODEL (defaults to whisper-large-v3-turbo) if you need a different model."],"exampleFix":"# before\nSTT_PROVIDER=groq\n# key missing\n\n# after\nSTT_PROVIDER=groq\nSTT_GROQ_API_KEY=gsk_yourgroqkey","handlingStrategy":"validation","validationCode":"if (process.env.STT_PROVIDER === \"groq\" && !process.env.STT_GROQ_API_KEY) {\n  throw new Error(\"STT_PROVIDER is 'groq' but STT_GROQ_API_KEY is not set.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  return new GroqSTT();\n} catch (e) {\n  if (/No Groq API key/i.test(e.message)) {\n    logger.error(\"Set STT_GROQ_API_KEY in .env, then restart.\");\n  }\n  throw e;\n}","preventionTips":["Keep a provider→required-env matrix and validate at startup.","Restart the process after setting a new key.","In Docker, confirm the env reaches the container."],"tags":["stt","groq","configuration","environment","credentials"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}