{"record":{"id":"fde95891badf2310","repo":"Mintplex-Labs/anything-llm","slug":"env-no-tts-provider-value-found-in-environment","errorCode":null,"errorMessage":"ENV: No TTS_PROVIDER value found in environment!","messagePattern":"ENV: No TTS_PROVIDER value found in environment!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/TextToSpeech/index.js","lineNumber":17,"sourceCode":"function getTTSProvider() {\n  const provider = process.env.TTS_PROVIDER || \"openai\";\n  switch (provider) {\n    case \"openai\":\n      const { OpenAiTTS } = require(\"./openAi\");\n      return new OpenAiTTS();\n    case \"elevenlabs\":\n      const { ElevenLabsTTS } = require(\"./elevenLabs\");\n      return new ElevenLabsTTS();\n    case \"generic-openai\":\n      const { GenericOpenAiTTS } = require(\"./openAiGeneric\");\n      return new GenericOpenAiTTS();\n    case \"kokoro\":\n      const { KokoroTTS } = require(\"./kokoro\");\n      return new KokoroTTS();\n    default:\n      throw new Error(\"ENV: No TTS_PROVIDER value found in environment!\");\n  }\n}\n\nmodule.exports = { getTTSProvider };\n","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/TextToSpeech/index.js#L1-L22","documentation":"Thrown by getTTSProvider() when process.env.TTS_PROVIDER contains a string that matches none of the switch cases. Important nuance: an unset TTS_PROVIDER never reaches this branch — the code applies `|| \"openai\"` first — so this error always means the variable IS set but spelled/cased/valued wrong. Supported values are exactly: openai, elevenlabs, generic-openai, kokoro (lowercase).","triggerScenarios":"Setting TTS_PROVIDER to anything outside {openai, elevenlabs, generic-openai, kokoro} — e.g. \"generic openai\" (space), \"openai-generic\", \"OpenAI\" (capitalized), \"azure\", \"browser\", or a provider name from a different/newer AnythingLLM version — and then invoking any text-to-speech path.","commonSituations":"Copy-pasting a provider name with different casing or word order; leftover value from an older config; expecting a provider that only exists in a newer release (kokoro was added later than openai/elevenlabs); whitespace or quotes around the value in .env; Docker env var typoed so a stale default from a mounted .env wins.","solutions":["Set TTS_PROVIDER to one of the exact supported lowercase values: openai, elevenlabs, generic-openai, or kokoro.","Check for stray whitespace, quotes, or capitalization in the value (the switch is case-sensitive).","If you intended a provider your version doesn't list (e.g. kokoro), upgrade AnythingLLM to a version that includes it.","Leave TTS_PROVIDER unset entirely if you want the openai default, then set TTS_OPEN_AI_KEY."],"exampleFix":"# before (.env)\nTTS_PROVIDER=OpenAI-Generic  # unrecognized -> Error\n\n# after (.env)\nTTS_PROVIDER=generic-openai\nTTS_OPEN_AI_COMPATIBLE_ENDPOINT=http://localhost:8080/v1","handlingStrategy":"validation","validationCode":"const SUPPORTED_TTS_PROVIDERS = [\"openai\", \"elevenlabs\", \"generic-openai\", \"kokoro\"];\n\nfunction assertTtsProviderConfigured() {\n  const p = process.env.TTS_PROVIDER || \"openai\";\n  if (!SUPPORTED_TTS_PROVIDERS.includes(p))\n    throw new Error(\n      `TTS_PROVIDER '${p}' is invalid. Supported: ${SUPPORTED_TTS_PROVIDERS.join(\", \")}`\n    );\n  return p;\n}","typeGuard":"/** @param {string} p */\nfunction isSupportedTtsProvider(p) {\n  return [\"openai\", \"elevenlabs\", \"generic-openai\", \"kokoro\"].includes(p);\n}","tryCatchPattern":"try {\n  tts = getTTSProvider();\n} catch (e) {\n  if (/No TTS_PROVIDER value found/.test(e.message))\n    return respondConfigError(`TTS_PROVIDER '${process.env.TTS_PROVIDER}' is not recognized`);\n  throw e;\n}","preventionTips":["Validate TTS_PROVIDER against the allowlist at boot, not on first use, so bad values surface in deploy logs.","Remember unset is safe (defaults to openai) — this error always means a set-but-unrecognized value.","Re-check the allowlist after upgrading AnythingLLM; providers are added over time."],"tags":["env","configuration","tts","provider-selection","typo"],"backgroundTag":"invalid-config-value","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"}