FlowiseAI/Flowise · error · Error

Failed to get response stream

Error message

Failed to get response stream

What it means

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).

Source

Thrown at packages/components/src/textToSpeech.ts:68

                                        | 'ballad'
                                        | 'coral'
                                        | 'echo'
                                        | 'fable'
                                        | 'nova'
                                        | 'onyx'
                                        | 'sage'
                                        | 'shimmer',
                                    input: text,
                                    response_format: 'mp3'
                                },
                                {
                                    signal: abortController.signal
                                }
                            )

                            const stream = Readable.fromWeb(response.body as unknown as ReadableStream)
                            if (!stream) {
                                throw new Error('Failed to get response stream')
                            }

                            await processStreamWithRateLimit(stream, onChunk, onEnd, resolve, reject, 640, 20, abortController, () => {
                                streamDestroyed = true
                            })
                            break
                        }

                        case TextToSpeechType.ELEVEN_LABS_TTS: {
                            onStart('mp3')

                            const client = new ElevenLabsClient({
                                apiKey: credentialData.elevenLabsApiKey
                            })

                            const response = await client.textToSpeech.stream(
                                textToSpeechConfig.voice || '21m00Tcm4TlvDq8ikWAM',
                                {

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Verify the OpenAI API key and account quota are valid before calling TTS.
  2. Retry the request; transient empty-body responses often succeed on retry.
  3. Check any HTTP proxy between Flowise and OpenAI is not stripping the streaming body.

Example fix

// before
const stream = Readable.fromWeb(response.body as unknown as ReadableStream)
if (!stream) throw new Error('Failed to get response stream')
// after
if (!response.body) throw new Error('OpenAI TTS returned no response body')
const stream = Readable.fromWeb(response.body as unknown as ReadableStream)
if (!stream) throw new Error('Failed to get response stream')
Defensive patterns

Strategy: try-catch

Validate before calling

function assertReadableBody(body: unknown): asserts body is ReadableStream {
  if (!body) throw new Error('OpenAI TTS returned no response body')
}

Type guard

function hasResponseBody(response: unknown): response is { body: ReadableStream } {
  return !!response && typeof response === 'object' && !!(response as any).body
}

Try / catch

try {
  const response = await openai.audio.speech.create({ ... }, { signal: abortController.signal })
  if (!response.body) throw new Error('Failed to get response stream')
  const stream = Readable.fromWeb(response.body as unknown as ReadableStream)
  await processStreamWithRateLimit(stream, onChunk, onEnd, resolve, reject, 640, 20, abortController, () => { streamDestroyed = true })
} catch (e) {
  if (/Failed to get response stream|no response body/i.test(e.message)) {
    // retry once, then surface a user-friendly TTS error
  }
  throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: Transient OpenAI API issue returning an empty body; an auth/quota error surfacing as a non-streaming response; a proxy stripping the response body.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/fc3b79b75c4f7168. Report an issue: GitHub.