{"record":{"id":"b283958ba5c35720","repo":"HeyPuter/puter","slug":"upstream-bad-request-b28395","errorCode":"upstream_bad_request","errorMessage":"xAI TTS request failed (status ${response.status})","messagePattern":"xAI TTS request failed \\(status (.+?)\\)","errorType":"http","errorClass":"HttpError","httpStatus":400,"severity":"error","filePath":"src/backend/drivers/ai-tts/providers/xai/XAITTSProvider.ts","lineNumber":189,"sourceCode":"            // Map upstream status to an `upstream_*` HttpError so the\n            // alarm gate skips it. Mirrors ElevenLabs' translator —\n            // 4xx and 5xx both surface as 400 to the client (with the\n            // appropriate legacyCode), 429 stays 429, auth stays 500.\n            const legacyCode =\n                response.status >= 500\n                    ? 'upstream_provider_unavailable'\n                    : response.status === 401 || response.status === 403\n                      ? 'upstream_auth_failed'\n                      : response.status === 429\n                        ? 'upstream_rate_limited'\n                        : 'upstream_bad_request';\n            const exposedStatus =\n                legacyCode === 'upstream_rate_limited'\n                    ? 429\n                    : legacyCode === 'upstream_auth_failed'\n                      ? 500\n                      : 400;\n            throw new HttpError(\n                exposedStatus,\n                errText || `xAI TTS request failed (status ${response.status})`,\n                {\n                    legacyCode,\n                    fields: {\n                        provider: 'xai',\n                        upstreamStatus: response.status,\n                    },\n                },\n            );\n        }\n\n        const arrayBuffer = await response.arrayBuffer();\n        const buffer = Buffer.from(arrayBuffer);\n        const stream = Readable.from(buffer);\n\n        // Determine content type from response or codec\n        const respContentType =","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/HeyPuter/puter/blob/908ec23eda38526170322c3edf71ba45ecb1ca95/src/backend/drivers/ai-tts/providers/xai/XAITTSProvider.ts#L171-L207","documentation":"Error \"xAI TTS request failed (status ${response.status})\" thrown in HeyPuter/puter.","triggerScenarios":"Thrown at src/backend/drivers/ai-tts/providers/xai/XAITTSProvider.ts:189 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the xAI API key and request parameters, then retry.","Inspect the upstream status code for the underlying cause."],"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"}