{"record":{"id":"5a6f3803603426bb","repo":"HeyPuter/puter","slug":"field-required-5a6f38","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/gemini/GeminiTTSProvider.ts","lineNumber":146,"sourceCode":"    }\n\n    async synthesize(\n        args: ISynthesizeArgs,\n    ): Promise<DriverStreamResult | { url: string; content_type: string }> {\n        const {\n            text,\n            voice: voiceArg,\n            model: modelArg,\n            instructions,\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 model = modelArg || DEFAULT_MODEL;\n        if (!GEMINI_TTS_MODELS.find(({ id }) => id === model)) {\n            throw new HttpError(\n                400,\n                `Invalid model: ${model}. Expected: ${GEMINI_TTS_MODELS.map(({ id }) => id).join(', ')}`,\n                {\n                    legacyCode: 'field_invalid',\n                    fields: {\n                        key: 'model',\n                        expected: GEMINI_TTS_MODELS.map(({ id }) => id).join(\n                            ', ',\n                        ),\n                        got: model,","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/HeyPuter/puter/blob/908ec23eda38526170322c3edf71ba45ecb1ca95/src/backend/drivers/ai-tts/providers/gemini/GeminiTTSProvider.ts#L128-L164","documentation":"GeminiTTSProvider.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 model/voice resolution and cost checks.","triggerScenarios":"Calling synthesize on the gemini provider with text omitted, null, empty, whitespace-only, or a non-string value.","commonSituations":"Empty prompt submission; passing instructions but leaving text blank; whitespace-only input; type mismatch from a loosely typed caller.","solutions":["Pass a non-empty text string.","Trim and validate text client-side before the call.","Use test_mode: true to validate connectivity without text."],"exampleFix":"// before\nawait driver.synthesize({ provider: 'gemini', voice: 'Kore' });\n// after\nawait driver.synthesize({ text: 'Hello world', provider: 'gemini', voice: 'Kore' });","handlingStrategy":"validation","validationCode":"function synthesizeGemini(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: 'gemini', ...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: 'gemini' });\n}","tryCatchPattern":null,"preventionTips":["Validate and trim text client-side before calling.","Disable submit while the text field is empty.","Use test_mode: true for connectivity checks without text."],"tags":["gemini","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"}