{"record":{"id":"54e0abca72e69ea7","repo":"HeyPuter/puter","slug":"field-required-54e0ab","errorCode":"field_required","errorMessage":"Missing required field: text","messagePattern":"Missing required field: text","errorType":"validation","errorClass":"HttpError","httpStatus":400,"severity":"error","filePath":"src/backend/drivers/ai-tts/providers/elevenlabs/ElevenLabsTTSProvider.ts","lineNumber":211,"sourceCode":"        args: ISynthesizeArgs,\n    ): Promise<DriverStreamResult | { url: string; content_type: string }> {\n        const {\n            text,\n            voice: voiceArg,\n            model: modelArg,\n            response_format,\n            output_format,\n            voice_settings,\n            voiceSettings,\n            test_mode,\n        } = args;\n\n        if (test_mode) {\n            return { url: SAMPLE_AUDIO_URL, content_type: 'audio' };\n        }\n\n        if (typeof text !== 'string' || !text.trim()) {\n            throw new HttpError(400, 'Missing required field: text', {\n                legacyCode: 'field_required',\n                fields: { key: 'text' },\n            });\n        }\n\n        const voiceId = voiceArg || this.defaultVoiceId;\n        const modelId = modelArg || DEFAULT_MODEL;\n\n        // Gate on the cost table rather than the advertised model list: an id\n        // we can't price is an id we can't bill for, and the vendor bills us\n        // for it either way.\n        if (!Object.hasOwn(ELEVENLABS_TTS_COSTS, modelId)) {\n            const expected = Object.keys(ELEVENLABS_TTS_COSTS);\n            throw new HttpError(\n                400,\n                `Invalid model: ${modelId}. Expected: ${expected.join(', ')}`,\n                {\n                    legacyCode: 'field_invalid',","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/HeyPuter/puter/blob/908ec23eda38526170322c3edf71ba45ecb1ca95/src/backend/drivers/ai-tts/providers/elevenlabs/ElevenLabsTTSProvider.ts#L193-L229","documentation":"ElevenLabsTTSProvider.synthesize requires a non-empty text string. If text is not a string or trims to empty (and test_mode is off), it throws HTTP 400 (legacyCode field_required) with fields.key='text', before voice/model resolution and credit checks.","triggerScenarios":"Calling synthesize on the elevenlabs provider with text omitted, null, empty, whitespace-only, or a non-string type.","commonSituations":"Form submission with empty input; passing prompt text into the wrong field; whitespace-only content; migrating from another provider and forgetting the text argument name.","solutions":["Pass a non-empty text string.","Trim and validate text on the client before calling.","Use test_mode: true during integration to bypass for connectivity checks."],"exampleFix":"// before\nawait driver.synthesize({ provider: 'elevenlabs', voice: '21m00Tcm4TlvDq8ikWAM' });\n// after\nawait driver.synthesize({ text: 'Hello world', provider: 'elevenlabs', voice: '21m00Tcm4TlvDq8ikWAM' });","handlingStrategy":"validation","validationCode":"function synthesizeElevenLabs(text, opts = {}) {\n  if (typeof text !== 'string' || !text.trim()) {\n    throw new Error('text is required and must be a non-empty string');\n  }\n  return driver.synthesize({ text, provider: 'elevenlabs', ...opts });\n}","typeGuard":"const isNonEmptyString = (v: unknown): v is string =>\n  typeof v === 'string' && v.trim().length > 0;\n\nif (isNonEmptyString(text)) {\n  await driver.synthesize({ text, provider: 'elevenlabs' });\n}","tryCatchPattern":null,"preventionTips":["Validate text client-side and disable submit while empty.","Use test_mode: true during integration to bypass the text check."],"tags":["elevenlabs","tts","validation","required-field","input"],"backgroundTag":null,"analyzedSha":"908ec23eda38526170322c3edf71ba45ecb1ca95","analyzedAt":"2026-08-12T20:53:15.911Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}