fishaudio/fish-speech · warning · HTTPException

Streaming only supports WAV format

Error message

Streaming only supports WAV format

What it means

Raised by the TTS endpoint when the request sets streaming=true but format is anything other than "wav". Streaming synthesis emits PCM/WAV chunks incrementally, which is not possible for formats that require post-encoding (e.g. mp3).

Source

Thrown at tools/server/views.py:167

    Generate speech from text using TTS model.
    """
    try:
        # Get the model from the app
        app_state = request.app.state
        model_manager: ModelManager = app_state.model_manager
        engine = model_manager.tts_inference_engine
        sample_rate = engine.decoder_model.sample_rate

        # Check if the text is too long
        if app_state.max_text_length > 0 and len(req.text) > app_state.max_text_length:
            raise HTTPException(
                HTTPStatus.BAD_REQUEST,
                content=f"Text is too long, max length is {app_state.max_text_length}",
            )

        # Check if streaming is enabled
        if req.streaming and req.format != "wav":
            raise HTTPException(
                HTTPStatus.BAD_REQUEST,
                content="Streaming only supports WAV format",
            )

        # Perform TTS
        if req.streaming:
            return StreamResponse(
                iterable=inference_async(req, engine),
                headers={
                    "Content-Disposition": f"attachment; filename=audio.{req.format}",
                },
                content_type=get_content_type(req.format),
            )
        else:
            fake_audios = next(inference(req, engine))
            buffer = io.BytesIO()
            sf.write(
                buffer,

View on GitHub (pinned to befe400174)

Solutions

  1. Set format to "wav" (lowercase) when streaming is enabled.
  2. Disable streaming (streaming=false) if you need mp3 or another encoded format; the whole file is returned after synthesis.

Example fix

# before
{"text": "hi", "streaming": True, "format": "mp3"}

# after
{"text": "hi", "streaming": True, "format": "wav"}
Defensive patterns

Strategy: validation

Validate before calling

def normalize(req):
    if req.get("streaming"):
        req["format"] = "wav"
    return req

Prevention

When it happens

Trigger: POST /v1/tts with {"streaming": true, "format": "mp3"} (or opus/flac/etc.). Any format value != "wav" combined with streaming triggers HTTP 400.

Common situations: Clients copying an OpenAI TTS example that requests mp3 and then adding streaming=true; assuming all formats stream; case-sensitivity issues ("WAV" vs "wav").

Related errors


AI-assisted analysis of fishaudio/fish-speech@befe400174 (2026-08-27). Data as JSON: /api/errors/869a3cdfb10a5604. Report an issue: GitHub.