{"record":{"id":"d3cad5ba42dbe2ca","repo":"danny-avila/LibreChat","slug":"invalid-provider","errorCode":null,"errorMessage":"Invalid provider","messagePattern":"Invalid provider","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/server/services/Files/Audio/STTService.js","lineNumber":294,"sourceCode":"  }\n\n  /**\n   * Sends an STT request to the specified provider.\n   * @async\n   * @param {string} provider - The STT provider to use.\n   * @param {Object} sttSchema - The STT schema for the provider.\n   * @param {Object} requestData - The data required for the STT request.\n   * @param {Buffer} requestData.audioBuffer - The audio data to be transcribed.\n   * @param {Object} requestData.audioFile - The audio file object containing originalname, mimetype, and size.\n   * @param {string} requestData.language - The language code for the transcription.\n   * @param {string[]} [allowedAddresses] - Section-level SSRF exemption list of host:port pairs.\n   * @returns {Promise<string>} A promise that resolves to the transcribed text.\n   * @throws {Error} If the provider is invalid, the response status is not 200, or the response data is missing.\n   */\n  async sttRequest(provider, sttSchema, { audioBuffer, audioFile, language }, allowedAddresses) {\n    const strategy = this.providerStrategies[provider];\n    if (!strategy) {\n      throw new Error('Invalid provider');\n    }\n\n    const fileExtension = getFileExtensionFromMime(audioFile.mimetype);\n\n    const audioReadStream = Readable.from(audioBuffer);\n    audioReadStream.path = `audio.${fileExtension}`;\n\n    const [url, data, headers] = strategy.call(\n      this,\n      sttSchema,\n      audioReadStream,\n      audioFile,\n      language,\n    );\n\n    const options = { headers };\n\n    applyAxiosProxyConfig(options, url);","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/danny-avila/LibreChat/blob/5ff282f9006c436e561de1afd39a481bea1ef0d8/api/server/services/Files/Audio/STTService.js#L276-L312","documentation":"sttRequest looks up this.providerStrategies[provider]; if the provider string is not a registered strategy key it throws synchronously before any network call. Only the providers bound in the STTService constructor are valid. This guards against an unknown/mistyped provider reaching the HTTP layer.","triggerScenarios":"The provider returned by getProviderSchema (or passed directly) does not match a key in providerStrategies — e.g. casing mismatch, a constant value that drifted, or a provider name configured that has no strategy implementation.","commonSituations":"librechat-data-provider STTProviders constant value changed and the service wasn't updated; config hand-edited with a wrong provider string; future provider referenced before its strategy was implemented.","solutions":["Ensure the `speech.stt` provider key matches a supported STTProviders constant exactly.","Confirm only one provider is configured (getProviderSchema returns the sole entry).","Upgrade librechat-data-provider and the API service together so the constant values and strategy keys agree."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"const { STTProviders } = require('librechat-data-provider');\nif (!Object.values(STTProviders).includes(provider)) {\n  throw new Error(`Unknown STT provider: ${provider}`);\n}","typeGuard":"/** @param {string} p */\nfunction isValidSttProvider(p) {\n  const { STTProviders } = require('librechat-data-provider');\n  return Object.values(STTProviders).includes(p);\n}","tryCatchPattern":null,"preventionTips":["Source provider names from STTProviders constants, never string literals.","Upgrade librechat-data-provider and the API service together to keep constants aligned.","Add a startup assertion that every providerStrategies key maps to a known constant."],"tags":["stt","provider","config","strategy"],"backgroundTag":null,"analyzedSha":"5ff282f9006c436e561de1afd39a481bea1ef0d8","analyzedAt":"2026-08-12T21:38:08.145Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}