{"record":{"id":"7d88707d9ff70dba","repo":"HeyPuter/puter","slug":"bad-request-7d8870","errorCode":"bad_request","errorMessage":"Text exceeds maximum length of 15,000 characters","messagePattern":"Text exceeds maximum length of 15,000 characters","errorType":"validation","errorClass":"HttpError","httpStatus":400,"severity":"error","filePath":"src/backend/drivers/ai-tts/providers/xai/XAITTSProvider.ts","lineNumber":120,"sourceCode":"            language,\n            response_format,\n            output_format,\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        if (text.length > 15000) {\n            throw new HttpError(\n                400,\n                'Text exceeds maximum length of 15,000 characters',\n                { legacyCode: 'bad_request' },\n            );\n        }\n\n        const voice = voiceArg || DEFAULT_VOICE;\n\n        const actor = Context.get('actor')!;\n        const ucentsPerChar = XAI_TTS_COSTS['xai-tts'] ?? 0;\n        const totalCost = ucentsPerChar * text.length;\n\n        const usageAllowed = await this.meteringService.hasEnoughCredits(\n            actor,\n            totalCost,\n        );\n        if (!usageAllowed) {\n            throw new HttpError(402, 'Insufficient funds', {","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/HeyPuter/puter/blob/908ec23eda38526170322c3edf71ba45ecb1ca95/src/backend/drivers/ai-tts/providers/xai/XAITTSProvider.ts#L102-L138","documentation":"Error \"Text exceeds maximum length of 15,000 characters\" thrown in HeyPuter/puter.","triggerScenarios":"Thrown at src/backend/drivers/ai-tts/providers/xai/XAITTSProvider.ts:120 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Split the text into chunks of 15,000 characters or fewer and synthesize each chunk separately.","Shorten the input text to fit the xAI TTS limit."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"908ec23eda38526170322c3edf71ba45ecb1ca95","analyzedAt":"2026-08-12T20:53:15.911Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}