{"record":{"id":"fc3b79b75c4f7168","repo":"FlowiseAI/Flowise","slug":"failed-to-get-response-stream","errorCode":null,"errorMessage":"Failed to get response stream","messagePattern":"Failed to get response stream","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/src/textToSpeech.ts","lineNumber":68,"sourceCode":"                                        | 'ballad'\n                                        | 'coral'\n                                        | 'echo'\n                                        | 'fable'\n                                        | 'nova'\n                                        | 'onyx'\n                                        | 'sage'\n                                        | 'shimmer',\n                                    input: text,\n                                    response_format: 'mp3'\n                                },\n                                {\n                                    signal: abortController.signal\n                                }\n                            )\n\n                            const stream = Readable.fromWeb(response.body as unknown as ReadableStream)\n                            if (!stream) {\n                                throw new Error('Failed to get response stream')\n                            }\n\n                            await processStreamWithRateLimit(stream, onChunk, onEnd, resolve, reject, 640, 20, abortController, () => {\n                                streamDestroyed = true\n                            })\n                            break\n                        }\n\n                        case TextToSpeechType.ELEVEN_LABS_TTS: {\n                            onStart('mp3')\n\n                            const client = new ElevenLabsClient({\n                                apiKey: credentialData.elevenLabsApiKey\n                            })\n\n                            const response = await client.textToSpeech.stream(\n                                textToSpeechConfig.voice || '21m00Tcm4TlvDq8ikWAM',\n                                {","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/src/textToSpeech.ts#L50-L86","documentation":"Thrown by the OpenAI text-to-speech path after `Readable.fromWeb(response.body)` returns a falsy stream. In practice this guard is hard to reach because fromWeb throws on a null body, but it exists to fail loudly if the OpenAI response carried no usable body (e.g. an error/empty payload that did not raise upstream).","triggerScenarios":"The OpenAI audio.speech.create call returns a response whose body is null/undefined yet did not throw, so the resulting Readable is falsy. The guard is `if (!stream)` at textToSpeech.ts:67.","commonSituations":"Transient OpenAI API issue returning an empty body; an auth/quota error surfacing as a non-streaming response; a proxy stripping the response body.","solutions":["Verify the OpenAI API key and account quota are valid before calling TTS.","Retry the request; transient empty-body responses often succeed on retry.","Check any HTTP proxy between Flowise and OpenAI is not stripping the streaming body."],"exampleFix":"// before\nconst stream = Readable.fromWeb(response.body as unknown as ReadableStream)\nif (!stream) throw new Error('Failed to get response stream')\n// after\nif (!response.body) throw new Error('OpenAI TTS returned no response body')\nconst stream = Readable.fromWeb(response.body as unknown as ReadableStream)\nif (!stream) throw new Error('Failed to get response stream')","handlingStrategy":"try-catch","validationCode":"function assertReadableBody(body: unknown): asserts body is ReadableStream {\n  if (!body) throw new Error('OpenAI TTS returned no response body')\n}","typeGuard":"function hasResponseBody(response: unknown): response is { body: ReadableStream } {\n  return !!response && typeof response === 'object' && !!(response as any).body\n}","tryCatchPattern":"try {\n  const response = await openai.audio.speech.create({ ... }, { signal: abortController.signal })\n  if (!response.body) throw new Error('Failed to get response stream')\n  const stream = Readable.fromWeb(response.body as unknown as ReadableStream)\n  await processStreamWithRateLimit(stream, onChunk, onEnd, resolve, reject, 640, 20, abortController, () => { streamDestroyed = true })\n} catch (e) {\n  if (/Failed to get response stream|no response body/i.test(e.message)) {\n    // retry once, then surface a user-friendly TTS error\n  }\n  throw e\n}","preventionTips":["Validate the OpenAI API key and quota before invoking TTS.","Guard response.body for null before calling Readable.fromWeb.","Retry transient empty-body responses; inspect any proxy between Flowise and OpenAI."],"tags":["tts","openai","streaming","network"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}