{"record":{"id":"ea058a5e4c3f7da8","repo":"vercel/ai","slug":"deepgram-speech-model-this-modelid-requires-a","errorCode":null,"errorMessage":"Deepgram speech model \"${this.modelId}\" requires a `voice` to be set (e.g. voice: 'thalia').","messagePattern":"Deepgram speech model \"(.+?)\" requires a `voice` to be set \\(e\\.g\\. voice: 'thalia'\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/deepgram/src/deepgram-speech-model.ts","lineNumber":77,"sourceCode":"    instructions,\n    providerOptions,\n  }: Parameters<SpeechModelV4['doGenerate']>[0]) {\n    const warnings: SharedV4Warning[] = [];\n\n    // Parse provider options\n    const deepgramOptions = await parseProviderOptions({\n      provider: 'deepgram',\n      providerOptions,\n      schema: deepgramSpeechModelOptionsSchema,\n    });\n\n    // Compose the upstream model ID from voice/language when a bare voice\n    // family ID is used; full voice IDs (e.g. `aura-2-thalia-en`) pass through.\n    let upstreamModelId: string = this.modelId;\n    if (VOICE_FAMILY_IDS.has(this.modelId)) {\n      const trimmedVoice = voice?.trim();\n      if (!trimmedVoice) {\n        throw new Error(\n          `Deepgram speech model \"${this.modelId}\" requires a \\`voice\\` to be set (e.g. voice: 'thalia').`,\n        );\n      }\n      if (language === 'auto') {\n        warnings.push({\n          type: 'compatibility',\n          feature: 'language',\n          details: `Deepgram TTS models do not support automatic language detection. Language \"en\" was used instead.`,\n        });\n      }\n      upstreamModelId = `${this.modelId}-${trimmedVoice}-${language && language !== 'auto' ? language : 'en'}`;\n    }\n\n    // Create request body\n    const requestBody = {\n      text,\n    };\n","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/deepgram/src/deepgram-speech-model.ts#L59-L95","documentation":"Deepgram speech models identified only by a bare voice family ID (e.g. 'aura-2') do not encode an actual voice, so the SDK requires an explicit `voice` option to compose the upstream model ID (e.g. 'aura-2-thalia-en'). Full voice IDs like 'aura-2-thalia-en' pass through unchanged. The SDK throws this error in getArgs when a bare family ID is used but voice is missing or empty/whitespace.","triggerScenarios":"Calling streamSpeech/generateSpeech with a Deepgram modelId that is in VOICE_FAMILY_IDS while omitting providerOptions voice, or passing an empty string or whitespace-only voice. E.g. createDeepgram({ modelId: 'aura-2' }) without voice.","commonSituations":"Copying a model family name from Deepgram docs instead of the full voice ID; refactoring code that previously used a full model ID; dynamically building the modelId and ending up with a family name; typo making voice an empty string after .trim().","solutions":["Set the `voice` provider option, e.g. voice: 'thalia', when using a bare voice family ID","Or pass a full Deepgram voice ID as modelId, e.g. 'aura-2-thalia-en', which bypasses the voice requirement","Ensure the voice value is a non-empty, non-whitespace string"],"exampleFix":"// before\nconst model = deepgram.speech('aura-2');\n// after\nconst model = deepgram.speech('aura-2', { voice: 'thalia' });\n// or\nconst model = deepgram.speech('aura-2-thalia-en');","handlingStrategy":"validation","validationCode":"const VOICE_FAMILY_IDS = new Set(['aura-2']); // subset; check the package's VOICE_FAMILY_IDS\nfunction assertDeepgramVoice(modelId, options) {\n  if (VOICE_FAMILY_IDS.has(modelId) && !(options?.voice && options.voice.trim())) {\n    throw new Error(`Deepgram model \"${modelId}\" requires a non-empty voice option`);\n  }\n}","typeGuard":"function hasVoice(o): o is { voice: string } {\n  return typeof (o as any)?.voice === 'string' && (o as any).voice.trim().length > 0;\n}","tryCatchPattern":"null","preventionTips":["Prefer full voice IDs (e.g. 'aura-2-thalia-en') in production configs","Keep a central factory that always supplies voice for family IDs","Trim and validate voice input at configuration load time"],"tags":["deepgram","speech","configuration","missing-parameter"],"backgroundTag":"missing-required-option","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}